Re: Interesting Problem
| From: | Yoed | Date: | Thu, 10 Jan 2002 05:41:34 +0000 |
| Subject: | Re: Interesting Problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-79989@lists.php.net to get a copy of this message | ||
Thanks for the people who tried ot help me.
I posted on the mysql list and they offered me this elegent solution:
-create a temp table
-select data from table x
-insert data into temp table
-select data from table y
-insert data into the same temp table
-grab the data from the temp table sorted by whichever column & display
it however
-drop the temp table
Pretty nice eh?... now just to look up temp tables :-)
Yoed
Yoed <yoed@zarcrom.com> wrote in message
news:20020109233626.36494.qmail@pb1.pair.com...
> Hi... I have an interesting problem I don't know which way to solve. So
I'll
> shoot it out to you guys and see what you might offer.
>
> I have two databases, say X, and Y:
>
> CREATE TABLE X(
> Id int(11) NOT NULL auto_increment,
> Dep_Date date,
> Return_Date date,
> Cat1_Status varchar(100),
> Cat2_Status varchar(100),
> Cat3_Status varchar(100),
> Cat4_Status varchar(100),
> PRIMARY KEY (Id));
>
> CREATE TABLE Y(
> Id int(11) NOT NULL auto_increment,
> Dep_Date date,
> Return_Date date,
> A_Status varchar(100),
> B_Status varchar(100),
> C_Status varchar(100),
> D_Status varchar(100),
> E_Status varchar(100),
> PRIMARY KEY (Id));
>
> Now what I am trying to do is get it to display on one page one listing in
> Chronoligical order based on the Dep_Date from BOTH of these tables.
Trying
> something simple like
> mysql_query("SELECT Id, Dep_Date, Return_DateFROM X,Y WHERE Dep_Date LIKE
> '%$SelectDate%' OR Return_Date LIKE '%$SelectDate%' ORDER BY
> Dep_Date");
> Will give you a ton of errors, and I'm not very fimilar with JOIN and SQL
> and how that works. My idea was to create two querys, but the results in
> somesort of array, and then order the array by date... I was wondering
> though if this is a good efficient way or if you guys have any better
> suggestions as to what I should do.
>
> Thanks for your time and help,
> Yoed
>
>