Re: [PHP-DB] Combining 2 queries into 1?

2004-05-30 Thread Kim Steinhaug
Thanks for your response, however you missunderstood my question. I just posted the sollution in this thread over. I was looking for a query that gave me the total amount on users which had a userID and the total without a userID. Selecting (*) would give me both the anonymous and logged users. -

[PHP-DB] Re: Combining 2 queries into 1?

2004-05-30 Thread Kim Steinhaug
After crawling through the MySql reference I finally found the function I was looking for, the sollution for combining theese two queries would be : SELECT count( * ) AS online_anonymous, sum( sign( uid ) ) AS online_members FROM `database` I also benchmarked this and the performance went j

Re: [PHP-DB] Combining 2 queries into 1?

2004-05-30 Thread Jonathan Hadddad
How about select count(*) from online Jon On May 30, 2004, at 1:23 PM, Kim Steinhaug wrote: I have theese two queries : select count(*) as online from online where uid=''; select count(*) as online from online where uid!=''; Each online user has a uid (UserID), so if their logged inn this field wil

[PHP-DB] Re: Combining 2 queries into 1?

2004-05-30 Thread Kim Steinhaug
And ofcourse, one part I didnt take into the equation, one complex query doesnt always execute faster than two fast queries. So I might as well be sure that the environment is optimized for the two queries im already having... I still however would like to know if its possible to join the two int

[PHP-DB] Combining 2 queries into 1?

2004-05-30 Thread Kim Steinhaug
I have theese two queries : select count(*) as online from online where uid=''; select count(*) as online from online where uid!=''; Each online user has a uid (UserID), so if their logged inn this field will represent their unique uid. If not logged in its set to nothing. To detect how many onl