Jump to content

Operand should contain 1 column error


EchoFool

Recommended Posts

I have never had this error before and no idea what to do to fix it... this is my query:

 

 

$GetConversation = mysql_query("select distinct(contact1,contact2,contact3)
as touch from ((select distinct(messages.receiver) 
as contact1 from messages where messages.sender = 3 or messages.receiver = 3)
as foo, (select distinct(textmessages.receiver) 
as contact2 from textmessages where textmessages.sender = 3 or textmessages.receiver = 3) 
as bar, (select distinct(phonecalls.receiver) 
as contact3 from phonecalls where phonecalls.sender = 3 or phonecalls.receiver = 3) 
as bat) WHERE phonecalls.receiver='$ID' or phonecalls.sender='$ID' 
or textmessages.receiver='$ID' or textmessages.sender='$ID' 
or messages.receiver='$ID' or messages.sender='$ID'")
or die(mysql_error());

 

If you need to know what it's meant to do then ill type it for ya, if its just a syntax thing where have i gone wrong?

Link to comment
https://forums.phpfreaks.com/topic/89002-operand-should-contain-1-column-error/
Share on other sites

When using DISTINCT, you can only specify one column. So, you have to fix this: distinct(contact1,contact2,contact3)

 

http://dev.mysql.com/doc/refman/5.0/en/select.html

 

Is distinct the best thing to use for this? In your opinion ? Or should i try some other method?

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.