Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. then perform this select on table 1 (select one),
  2.  
  3. SELECT IF (1=1,"YES", "NO"), but, when I replace 1=1 with my select, like this:
  4.  
  5. SELECT IF ((SELECT count(*) FROM Table1)>0,"YES", "NO")
  6.  
  7. SELECT
  8. IF(inner_table.count_column > 0, "YES", "NO) -- here we select the 'count_column' from 'inner_table
  9. FROM
  10. (
  11. (SELECT count(*) as count_column FROM table1)
  12. ) as inner_table -- aliasing the inner select as 'inner_table'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement