Jump to content

2 AND commands?


liamloveslearning

Recommended Posts

Hi all,

I need to query my database where x is y and where x is also z if this makes sense?

 

My query is something similiar to...  SELECT * FROM 'x' WHERE x=x AND model_pictures.theme=1  AND model_pictures.theme=3 only it isnt working, Is it possible to have somthing like..

 

AND model_pictures.theme=3 AND 1?

Link to comment
https://forums.phpfreaks.com/topic/209980-2-and-commands/
Share on other sites

model_pictures.theme=1  AND model_pictures.theme=3

 

A column can only have a single value at any time. ^^^ Using AND there won't match anything because the value cannot be both 1 and 3 at the same time. You need to use OR to form a union/set of rows that have the values 1 OR 3.

Link to comment
https://forums.phpfreaks.com/topic/209980-2-and-commands/#findComment-1095998
Share on other sites

My query is

SELECT model_login.id, model_login.username, model_pictures.id, model_pictures.user_id, model_pictures.user_picture, model_pictures.user_picture_date, model_pictures.user_pic_approval FROM model_pictures, model_login WHERE model_pictures.user_id=model_login.id  AND model_pictures.user_pic_approval=1  AND model_pictures.theme=1 OR model_pictures.theme=3

 

Does this seem valid ?

Link to comment
https://forums.phpfreaks.com/topic/209980-2-and-commands/#findComment-1096001
Share on other sites

Archived

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

×
×
  • Create New...

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.