Iv been trying to combine these 4 sql querys into one but its just too complex for me My brains about to explode!
SELECT * ID, category_name FROM mb_category";
SELECT * FROM mb_list";
SELECT COUNT(ID) AS Posts FROM mb_messages WHERE (mb_id = 2)";
SELECT COUNT(ID) AS Threads FROM mb_messages WHERE (mb_id = 2) AND (parent = 0)";
SELECT poster_id, title FROM mb_messages WHERE (ID = (SELECT MAX(ID) AS message FROM mb_messages mb_messages_1 WHERE (mb_id = 2)))";
Anybody able to have a go at it?
Combine these 4 selects into 1 statment?
Moderator: General Moderators
Re: Combine these 4 selects into 1 statment?
UNION could be helpful
There are 10 types of people in this world, those who understand binary and those who don't
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Combine these 4 selects into 1 statment?
I see 5 statements. 
How do mb_category, mb_list and mb_messages relate to each other?
How do mb_category, mb_list and mb_messages relate to each other?
(#10850)