Posted by Brian on 10/14/90 11:48
Hi all (again)
More I get into MySQL and the more I read, the more I get confessed
I am trying to run a statement that does the following
Return a DISTINCT count of the number of records between two timestamps
SELECT count(DISTINCT dnote) as Total_Orders FROM $table WHERE (timestamp
BETWEEN 1146438000 AND 1148338800)
this works and brings back a result which I need
Now I need to say out of those returned records, how many of them had a
brand = 'X' and brand = 'Y' and brand = 'Z'
e.g.
Total_Orders = 900
Total where brand is X = 300
Total where brand is Y = 400
Total where brand is Z = 200
X+Y+Z should = Total_Orders
What I can't work out is how to say only SUM up the X,Y Z where a brand =
X,Y,Z
Thanks
Brian
[Back to original message]
|