By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,045 Members | 1,743 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,045 IT Pros & Developers. It's quick & easy.

How can I get the full results from this mysql query?

P: 1
This query gives me the data that contains the values specified in the query based on counts.

Expand|Select|Wrap|Line Numbers
  1. SELECT id
  2.      , GROUP_CONCAT(tmp ORDER BY tmp) tmps
  3.   FROM 
  4.      ( SELECT id,tmp1 tmp FROM tmptb
  5.        UNION
  6.        SELECT id,tmp2 tmp FROM tmptb
  7.        UNION
  8.        SELECT id,tmp3 tmp FROM tmptb
  9.        UNION
  10.        SELECT id,tmp4 tmp FROM tmptb
  11.      ) x
  12.  WHERE tmp IN (28,53,65)   
  13.  GROUP 
  14.     BY id 
  15. HAVING COUNT(*) >= 2;
The problem is that it only gives the id, and the specified values (if at least two of them present in the concatenated rows). How can I change it so that it displays the concatenated rows that contains the specified values (at least 2 of them)? please. thank you.
1 Week Ago #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.