MySQL loop
#5

PHP код:
"SELECT IF(COUNT(*) = SUM(CASE WHEN Org=1 THEN 1 ELSE 0 END),1,0) FROM Player" 
Result will be either 1 or 0 depending on whether the total players is equal to the player that have "Org" set to 1.

EDIT: Use zPain's version. The speed is not even noticeable (~20-50 microseconds for 650 rows) but more readable and understandable.
Reply


Messages In This Thread
MySQL loop - by saffierr - 15.05.2016, 20:13
Re: MySQL loop - by KevinReinke - 15.05.2016, 20:16
Re: MySQL loop - by saffierr - 15.05.2016, 20:41
Re: MySQL loop - by zPain - 15.05.2016, 20:57
Re: MySQL loop - by Konstantinos - 15.05.2016, 21:02
Re: MySQL loop - by Private200 - 15.05.2016, 21:03

Forum Jump:


Users browsing this thread: 1 Guest(s)