'SQL'에 해당되는 글 1건

  1. 2009.07.22 select 1;

hi,

I think what you want is to print `TRUE`(1) if there exists at least one match else `FALSE`(0)
for that you can use :

select count(*) >= 1 from test where testdata = 5;

This will return `1` if there is one or more rows that satisfies the given condition.
else if no match is found it will return `0`


If you want the number of matching rows then simply execute the following.

select count(*) from test where testdata = 5;

hope that will solve the problem.

출 처 : http://www.webyog.com/forums//lofiversion/index.php/t3149.html
Posted by 김주일