Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar Mark Forums Read
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 02-10-2005, 01:57 PM   #1
Zester
Confirmed User
 
Zester's Avatar
 
Industry Role:
Join Date: Jul 2003
Posts: 5,344
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?
__________________
* Mainstream ? $65 per sale
* new male contraception
Zester is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-10-2005, 02:05 PM   #2
cfU
Confirmed User
 
Join Date: Jan 2003
Posts: 933
select status, count(*)
from galleries
where status in ('Approved','Pending')
group by status
cfU is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-10-2005, 02:06 PM   #3
Nathan
Confirmed User
 
Industry Role:
Join Date: Jul 2003
Posts: 3,108
SELECT SUM(IF(status='Approved',1,0)) approved, SUM(IF(status='Pending',1,0)) pending FROM galleries;
__________________
"Think about it a little more and you'll agree with me, because you're smart and I'm right."
- Charlie Munger
Nathan is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-10-2005, 02:07 PM   #4
Clarion
Confirmed User
 
Join Date: Jan 2005
Location: Ontario, OR
Posts: 148
I believe...

SELECT * count(status='Approved') as approved, count(status='Pending') as pending
FROM galleries

...it should work for ya.
__________________
Structure Northwest :: the cure for the common code ::
AIM: Asatruel | Yahoo!: Asatruel | ICQ: 111-638-053
Clarion is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-10-2005, 02:20 PM   #5
calmlikeabomb
Confirmed User
 
calmlikeabomb's Avatar
 
Join Date: May 2004
Location: SW Palm Bay, Florida
Posts: 1,323
Quote:
Originally Posted by Zester
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?
Code:
$approvedquery = "SELECT * FROM galleries WHERE status='Approved'";
$approved = @mysql_results($approvedquery);
$numapproved = mysql_num_rows($approved);

There are currently $numapproved approved galleries.
That would be the correct way to do it......
__________________
subarus.
calmlikeabomb is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks
Thread Tools



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.