![]() |
SQL COUNT(condition)?
Hi,
I have two queries: Code:
SELECT COUNT(*) AS comments Code:
SELECT COUNT(*) AS comments2 I was thinking something like: Code:
SELECT COUNT(*) AS comments, COUNT(IF ng_comment.dateline <= 1262487011) AS comments2 Any help? Thanks. PS. I also posted this on vbulletin.com, but I think this forum is a bit busier than the programming discussion on vbulletin.com. (http://www.vbulletin.com/forum/showt...28condition%29) --------------- Added [DATE]1263058583[/DATE] at [TIME]1263058583[/TIME] --------------- I figured it out for myself. I used: Code:
SELECT COUNT(*) AS totalcomments, COUNT(CASE WHEN ng_comment.dateline <= 1262487011 THEN 1 ELSE null END) AS newercomments |
All times are GMT. The time now is 11:47 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|