TeamPhotoshop
Reviews, updates and in depth guides to your favourite mobile games - AppGamer.com
Forum Home Latest Posts Search Help Subscribe

SELECT Problem

Page: 1 Reply
Mar 28th 2002#37883 Report
Member since: Mar 18th 2001
Posts: 1452
I need to select data from 2 unrelated tables.

I've done other multiple selects by just using:
SELECT * FROM table_1, table2

On this one, I need to get all the data from 1 table, and all the data from table 2, but ordered by ID DESC.

I've tried:
SELECT * FROM table_1, table_2 ORDER by blah_id DESC

But, it completely ignores table_1.
Reply with Quote Reply
Mar 28th 2002#37887 Report
Member since: Mar 18th 2001
Posts: 1452
Well, I got it to work, in probably a less efficient and improper way, but it works.

I just did 2 queries:

$sql="SELECT * FROM $posttable ORDER by news_id DESC";
$result = mysql_query($sql);
$row = mysql_numrows($result);

$sql2="SELECT * FROM $posttheme";
$result2 = mysql_query($sql2);
$row2 = mysql_numrows($result2);
Reply with Quote Reply
Mar 30th 2002#38240 Report
Member since: Jun 30th 2001
Posts: 447
Mobile, read up on JOINS in the mySQL manual and you'll find you can do all sorts of kewl things.
Reply with Quote Reply
Mar 30th 2002#38250 Report
Member since: Mar 18th 2001
Posts: 1452
Yeah, but the 2 tables have no relation to each other. Pretty much everything I read the other night only showed JOIN for pulling data from 2 tables that have common values. At least that's what I got out of it.
Reply with Quote Reply
Page: 1 Back to top
Please login or register above to post in this forum