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 03-10-2007, 06:01 PM   #1
Mr. Mike
Confirmed User
 
Join Date: Aug 2004
Posts: 913
a little help with a mysql query, please.

Is it possible to count the total number of fields in a table that are empty? If so, please let me know, I cant find anything in the manual.
__________________
Sig for sale. ICQ: 163-545-054
Mr. Mike is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-10-2007, 06:13 PM   #2
Kaylum
Confirmed User
 
Industry Role:
Join Date: Aug 2005
Location: Costa Rica
Posts: 465
yes.

select count(*) from table_name where field1 isNULL and field2 isNULL and ...;

or if the fields are empty as in (they were set empty by code):

select count(*) from table_name where field1 = '' and field2 = '' and ...;

i don't know of any built-in mysql function that will help, due to the fact of varying structure of tables.

peace
__________________
-- "You can't stop ingenuity, trust me.."
Kaylum is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-10-2007, 06:14 PM   #3
Kaylum
Confirmed User
 
Industry Role:
Join Date: Aug 2005
Location: Costa Rica
Posts: 465
ooops, nevermind.

that just returns the number of records with "empty" fields.. not what you wanted.
__________________
-- "You can't stop ingenuity, trust me.."
Kaylum is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-10-2007, 06:16 PM   #4
Mr. Mike
Confirmed User
 
Join Date: Aug 2004
Posts: 913
Quote:
Originally Posted by Kaylum View Post
yes.

select count(*) from table_name where field1 isNULL and field2 isNULL and ...;

or if the fields are empty as in (they were set empty by code):

select count(*) from table_name where field1 = '' and field2 = '' and ...;

i don't know of any built-in mysql function that will help, due to the fact of varying structure of tables.

peace
Excellent! Thanks a million!
__________________
Sig for sale. ICQ: 163-545-054
Mr. Mike is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-10-2007, 06:23 PM   #5
Mr. Mike
Confirmed User
 
Join Date: Aug 2004
Posts: 913
ah, yeah I just noticed that now. It actually is what I need, but this couints tyhe entire database, enstead of a specific column. I need the blank fields in USERS where id=x
__________________
Sig for sale. ICQ: 163-545-054
Mr. Mike 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.