Advertisement
Guest User

Untitled

a guest
Apr 21st, 2015
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. SELECT col1, col2, col3, col4, Q1.col5, col6
  2. FROM TABLE_NAME,
  3. (SELECT col5 FROM TABLE_NAME WHERE col6 = 123456 GROUP BY col5) Q1
  4. WHERE col6 = 123456 AND TABLE_NAME.col5 = Q1.col5;
  5.  
  6.  
  7. SELECT count(1), col1, col2, col3, col4, Q1.col5, col6
  8. FROM TABLE_NAME,
  9. (SELECT col5 FROM TABLE_NAME WHERE col6 = 123456 GROUP BY col5) Q1
  10. WHERE col6 = 123456 AND TABLE_NAME.col5 = Q1.col5;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement