* Svens Klave
> Can anybody help me
> with select query

I can try.

> how to do this:
>
> I have table "foo1" with two fields "image" "check"
>
> | image | check |
> | 6782  | 0         |
> | 2732  | 1         |
> | 6734  | 1         |
>
> so I want to make query
> select * from foo1 where [so is it possible to make some if check=1 then
> image is image but if check=0 then into image goes other content for
> example "noimage"]
>
>
> I mean I need to check if there is  0 or 1 and so if check is 1 then show
> original number from image field but if there is 0 then it

SELECT check,IF(check,image,'noimage') AS image FROM foo1;

> changes original content to "noimage"

eh... a select statement can not change the database. The above SELECT will
change the output of the image column according to your specification, but
it will not change the database. You would need to use UPDATE for that:

UPDATE foo1 SET image = 'noimage' WHERE check = 0;

--
Roger


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to