snowboardr
Programmer
I am doing something wrong i would like to do a count inside this select for example:
is it possible to do two counts on one select? in different tables? I need to count the following in the same select statement:
SELECT COUNT(*) as postnumber FROM forumpost AS post WHERE post.ptid=th.tid
and
SELECT COUNT(*) as postnumber FROM forumpost AS post WHERE post.ptid=th.tid AND ptype=0
Jason
[red]Army[/red] : [white]Combat Engineer[/white] : [blue]21B[/blue]
Code:
SELECT th.tid, th.tname, th.tmain
(SELECT COUNT(*) as postnumber FROM forumpost AS post WHERE post.ptid=th.tid)
FROM thread as th WHERE tmain=1
is it possible to do two counts on one select? in different tables? I need to count the following in the same select statement:
SELECT COUNT(*) as postnumber FROM forumpost AS post WHERE post.ptid=th.tid
and
SELECT COUNT(*) as postnumber FROM forumpost AS post WHERE post.ptid=th.tid AND ptype=0
Jason
[red]Army[/red] : [white]Combat Engineer[/white] : [blue]21B[/blue]