This is probably pretty easy but I’m pulling a blank.
I have a database (structure below) that I want to see how many items are associated with each ID
Example of what I am looking for
Select file1 thru file10 and count how many of these fields have a value in them.
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(100) NOT NULL,
`cat_id` int(11) NOT NULL,
`file1` varchar(100) NOT NULL,
`file2` varchar(100) NOT NULL,
`file3` varchar(100) NOT NULL,
`file4` varchar(100) NOT NULL,
`file5` varchar(100) NOT NULL,
`file6` varchar(100) NOT NULL,
`file7` varchar(100) NOT NULL,
`file8` varchar(100) NOT NULL,
`file9` varchar(100) NOT NULL,
`file10` varchar(100) NOT NULL,
PRIMARY KEY (`id`)
I can count how many records I have in the database but for each record I want to know how many files I have.