GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   a little help with a mysql query, please. (https://gfy.com/showthread.php?t=713485)

Mr. Mike 03-10-2007 06:01 PM

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.

Kaylum 03-10-2007 06:13 PM

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

Kaylum 03-10-2007 06:14 PM

ooops, nevermind.

that just returns the number of records with "empty" fields.. not what you wanted. :)

Mr. Mike 03-10-2007 06:16 PM

Quote:

Originally Posted by Kaylum (Post 12052710)
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!

Mr. Mike 03-10-2007 06:23 PM

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


All times are GMT -7. The time now is 09:14 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123