![]() |
very easy SQL question
I need a simply SQL query to get the amount of 'Approved' galleries I have in database, and the amount of 'Pending' galleries I have in database
what do I use? it should be something like this: SELECT * count(status='Approved') approved, count(status='Pending') pending FROM galleries what do you say? |
select status, count(*)
from galleries where status in ('Approved','Pending') group by status |
SELECT SUM(IF(status='Approved',1,0)) approved, SUM(IF(status='Pending',1,0)) pending FROM galleries;
|
I believe...
SELECT * count(status='Approved') as approved, count(status='Pending') as pending FROM galleries ...it should work for ya. |
Quote:
Code:
$approvedquery = "SELECT * FROM galleries WHERE status='Approved'"; |
All times are GMT -7. The time now is 10:37 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123