Page 1 of 1

Data from two tables in one query, no join?

Posted: Thu Jun 14, 2007 4:02 am
by Smasher
query("
SELECT c.id, g.id as Gid
FROM containment c
FROM geezer g
ORDER BY c.`order`, g.`order`");

Then ofcourse loop through them...is it possible without using a join? They aren't joined in anyway possible, but I need to retrieve there dataset in one.

Posted: Thu Jun 14, 2007 4:11 am
by Smasher
CROSS JOIN.

Just for reference.

Data size

Posted: Thu Jun 14, 2007 4:52 am
by Gente
And what about count of c.id and count of g.id. Are you sure they are equal? :)

Posted: Thu Jun 14, 2007 7:58 am
by feyd
You're looking for a UNION.

Posted: Thu Jun 14, 2007 11:53 am
by Benjamin

Code: Select all

SELECT c.id, g.id as Gid FROM containment c, geezer g WHERE c.tkey=g.tkey ORDER BY c.`order`ASC, g.`order` ASC