Well, w/o any where condition, etc., what does select * from activities, disbursement order by activities.fillin, disbursements fillin; give you? I'd suspect all the activities, followed by the disbursements.
How about creating a results table, with all the fields, and do an INSERT ... SELECT on each of activities and disbursements, then SELECT from results and order by fillin? Regards - Miles Thompson At 05:20 PM 2/4/2002 +0200, Lauri Vain wrote: >Hi there, > >I have a somewhat urgent issue so I'll get right to the point. > >There are two tables and for simplicitys sake I stripped about 2/3 of >the tables structure. > >I need to order the data from two SQL tables by date. Basically a >chronological list from the two tables. Now, ordinarily I would do two >queries and put disbursements into one list and activities into another >one, just above it. But in this case they need to be mixed so that it >would be a TRUE chronological list. > >One way would be to do two queries and load all of the dates from the >two tables into a PHP array (and also define whether it's a disbursement >or activity) and then sort it in ascending order. Then I would have a >chronological list with information about ties of that table. Now I >could ask for the data by the name of the table and the date when I loop >through that PHP array and display it. > >That, however, is a bit "around the edge". Do I have any simple >alternatives? > >CREATE TABLE activities ( > id int(11) DEFAULT '0' NOT NULL auto_increment, > matterid int(11), > costtype enum('unit','hour'), > cost float(10,2), > actcount float(10,2), > fillin date, > PRIMARY KEY (id) >); > >CREATE TABLE disbursements ( > id int(11) DEFAULT '0' NOT NULL auto_increment, > matterid int(11), > disdesc varchar(30), > discost float(10,2), > fillin date, > PRIMARY KEY (id) >); > >Thanks in advance. > >Yours, >Lauri >-- >Tharapita Creations >[dynamic web applications] >[EMAIL PROTECTED] >Mobile: +372 53 410 610 > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php