6 Replies - 25251 Views - Last Post: 10 February 2008 - 11:47 AM

#1 alecoder  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 50
  • Joined: 11-January 08

how to delete one field in mysql table

Posted 09 February 2008 - 01:38 AM

hey all
i want delete one field in mysql table
for example Delete one field where id = "5"
see picture

Attached image(s)

  • Attached Image

Is This A Good Question/Topic? 0
  • +

Replies To: how to delete one field in mysql table

#2 Nayana  Icon User is offline

  • DIC Hawk - 나야나 नयन:
  • member icon

Reputation: 31
  • View blog
  • Posts: 824
  • Joined: 14-November 07

Re: how to delete one field in mysql table

Posted 09 February 2008 - 01:52 AM

What do you mean? You can't delete a field.

Are you trying to delete
  • One record?
  • The contents of a field within a record?
Thanks. And you better give us your attempt as well.

This post has been edited by Nayana: 09 February 2008 - 01:52 AM

Was This Post Helpful? 0
  • +
  • -

#3 alecoder  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 50
  • Joined: 11-January 08

Re: how to delete one field in mysql table

Posted 09 February 2008 - 02:14 AM

no i want delete field value
for example
we have table
-------------------------------------------
id name name2 name3 name4
-------------------------------------------
1 john pavel george abbye
-------------------------------------------
2 alex lilian nick jefry
-------------------------------------------

and i want delete value where id = 1 and if name || name2 || name3|| name4 value john delete then
i want delete one record ya

This post has been edited by alecoder: 09 February 2008 - 02:16 AM

Was This Post Helpful? 0
  • +
  • -

#4 chuck87  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 69
  • Joined: 07-September 07

Re: how to delete one field in mysql table

Posted 09 February 2008 - 07:09 AM

If you are trying to delete a row with ID= 1 you should do it like this

delete from tableName where ID=1;
Was This Post Helpful? 0
  • +
  • -

#5 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1642
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: how to delete one field in mysql table

Posted 09 February 2008 - 07:11 AM

Here is the mySQL Reference Manual that will help you tons in the future. For a delete the syntax is


Quote

DELETE [LOW_PRIORITY] [QUICK] [IGNORE] FROM tbl_name
[WHERE where_condition]
[ORDER BY ...]
[LIMIT row_count]



So all you would need for your questions would be a statement similar to


DELETE from table_name where id=1


Was This Post Helpful? 0
  • +
  • -

#6 alecoder  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 50
  • Joined: 11-January 08

Re: how to delete one field in mysql table

Posted 10 February 2008 - 09:50 AM

this deleting all where id = count
i want delete one element in table where id = count
for example we have id and img name
$id = 5;
$img_name = "img1000";

and we have table where writen meny img names
img1 img2 img3 img4 img5
and i want delete one element in tablename where id = $id and if some
img1 or img2 or img3 or img4 or img5 = $img_name delete this imgname
Was This Post Helpful? 0
  • +
  • -

#7 Nayana  Icon User is offline

  • DIC Hawk - 나야나 नयन:
  • member icon

Reputation: 31
  • View blog
  • Posts: 824
  • Joined: 14-November 07

Re: how to delete one field in mysql table

Posted 10 February 2008 - 11:47 AM

Why don't you just read a tutorial on SQL?

Anyway. What you are trying to do is change the value of the cell to nothing. You can't just delete a cell leaving a hole in the table. Just use the UPDATE statement.

UPDATE table_name SET imagename = NULL WHERE id = 1

This post has been edited by Nayana: 10 February 2008 - 11:48 AM

Was This Post Helpful? 1

Page 1 of 1