Mysql count columns
Posted
by Sergio
on Stack Overflow
See other posts from Stack Overflow
or by Sergio
Published on 2010-05-04T11:04:30Z
Indexed on
2010/05/04
11:08 UTC
Read the original article
Hit count: 275
mysql
I have a table for image gallery with four columns like:
foid | uid | pic1 | pic2 | pic3 | date |
-----------------------------------------------
104 | 5 | 1.jpg | 2.jpg | 3.jpg | 2010-01-01
105 | 14 | 8.jpg | | | 2009-04-08
106 | 48 | x.jpg | y.jpg | | 2010-08-09
Mysql query for the user's galleries looks like:
SELECT * FROM foto WHERE uid = $id order by foid DESC
The thing that I want to do is count the number of images (PIC1, PIC2, PIC3) in every of the listed galleries.
What is the best way for doing that?
© Stack Overflow or respective owner