Jump to content

Archived

This topic is now archived and is closed to further replies.

Michael

Query Construction

Recommended Posts

Hello

What I am trying to solve is as follows:

I have a table that contains three fields that record preferences of user car models selected from a fixed list of car makes. Although the list is finite, any field can contain any member of the car make list.

I want the ability to delete a car from the list. When I do that I want to go thru the table and replace the deleted car model with "empty"

I know I can do with with three queries, but am trying to figure out if I can do it with one query. I've been researching on the 'net but am not coming up with an answer.

What I would like to do is something like

UPDATE TABLE SET (field 1 = "empty" WHERE field 1 = 'toyata"),
(field 2 = "empty" WHERE field 2 = 'toyata"),
(field 3 = "empty" WHERE field 2 = 'toyata")
WHERE userid = "id";

I suppose my example is absurd but it gives the idea of what I want to do if possible.

Or just use three queries.

I would appreicate any comments.

Thanks



Share this post


Link to post
Share on other sites
See my response [a href=\"http://www.mysqlfreaks.com/forums/index.php?showtopic=8984&st=0&\" target=\"_blank\"]on this MySQLFreaks.com cross-post thread[/a].

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.