0

I would like to get two of the same value when I Query my database. I do not have amazing SQL knowledge so I wouldn't know where to start doing this so i'm asking for help from this friendly community. To help me explain what I am looking for I will show you what I mean.

"SELECT * FROM $databasename WHERE type='post' and type='friend_post' ORDER BY time desc"

(i put the area I am looking at in darker font) This is what I am trying to do but it dosen't seem to work. Thanks in advance for any help I get, it will be much apreciated.

Jordan
  • 3
  • 1

1 Answers1

0

This is because you check if type is both value, use IN instead.

Which would looks like

SELECT * 
FROM $databasename 
WHERE type IN('post','friend_post')
ORDER BY time desc
Jean-François Savard
  • 20,626
  • 7
  • 49
  • 76