[thelist] 2 columns infos in one query ?
Joshua Olson
joshua at waetech.com
Mon Dec 29 20:34:14 CST 2003
----- Original Message -----
From: "Damien COLA" <damiencola at wanadoo.fr>
Sent: Monday, December 29, 2003 8:04 PM
> This one is for Rudy's followers and other sql experts, not really web
> design related..
Damien,
Rudy's no longer on this list, so I'll bite.
> I made this query that gives me by day, the number of ads
>
> select added_date,COUNT(adID) as nbad
> FROM table_ad
> WHERE added_date >= '$sqldate_from'
> AND added_date <= '$sqldate_to'
> GROUP BY added_date
> ORDER BY added_date
Okay, how about this (should work in most db's, I'd think):
select added_date
,COUNT(adID) as nbad
,COUNT(DISTINCT sellerID) as sellercount
FROM table_ad
WHERE added_date >= '$sqldate_from'
AND added_date <= '$sqldate_to'
GROUP BY added_date
ORDER BY added_date
Probably a lot simpler than you thought?
:-)
<><><><><><><><><><>
Joshua Olson
Web Application Engineer
WAE Tech Inc.
http://www.waetech.com/service_areas/WA/
706.210.0168
More information about the thelist
mailing list