Wrox Home  
Search P2P Archive for: Go

  Return to Index  

sql_language thread: Pick values out of more than 1 table..


Message #1 by "SD-Studios" <info@s...> on Wed, 17 Jul 2002 23:53:39 +0200
Construct a union of all the tables as a subquery, then select the top 10
from that, as:

	SELECT top 10 from
		(select datecol from table1
			union
		 select datecol from table2
			union
		 select datecol from table3
			...
		 order by datecol) as unionquery;

--
Jeff Mason			Custom Apps, Inc.
Jeff@c...

-----Original Message-----
From: SD-Studios [mailto:info@s...]
Sent: Wednesday, July 17, 2002 5:54 PM
To: sql language
Subject: [sql_language] Pick values out of more than 1 table..


Hi!
I've got a no of tables, from which I'd like to select the 10 latest posts.
Not the 10 latest in each, but the 10 latest from all of them. Did you get
that? =) I've got date/time-fields in each table. Is this possible in some
way? Thanks!
--
MVH, Martin Johansson
CEO & Project Supervisor
SD-Studios, Squaremedia HB
+46 (0)70-3003320
http://www.sd-studios.com
http://www.swehost.com




  Return to Index