Jump to content

Finding the Newest in More then One Table


Daleeburg

Recommended Posts

Can this be done?

 

If i have 4 different tables (each is a different forum category) and i would like the name of the last 5 thread updated is there a way to do this. Also is there a way to prevent repeats so that if the same thread is updated twice in a row it only shows up once in the review.

 

Thank

~D

select Max(total) from
(
select 10 as total
UNION
select 12 as total
UNION
select 7 as total
UNION
select 44 as total
) as x

 

Use UNION to merge all the queries into a single table. Then do a max on this new 'table'.

 

So you'd replace

SELECT 44 AS total

, with

SELECT max(count) from forum_category WHERE user=99

 

Hope that helps

 

monk.e.boy

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.