Jump to content

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?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.