Re: Array Question

From: Date: Tue, 01 Apr 2003 17:07:49 +0000
Subject: Re: Array Question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-141847@lists.php.net to get a copy of this message
At 18:58 1-4-03, you wrote:
I have two tables that I want to display together as if they were one table and order them by a common date field. Because I am using MySQL I can't use the usually way I would do this. Create a store procedure or view. Does every row in tableA has a sibling row in tableB and vice versa, and is there some field that could combine them? For instance this date field, is it unique (one entry for every date) ?
If the answer is yes to both: $query="SELECT title, text, date FROM tableA as A, tableB as B WHERE A.date=B.date ORDER BY date" Now (AFAIK) if table A has 2 entries on april1 and table B has 3 entries on april1, you would get 2x3=6 resulting rows with all possible combinations. You could also link with any combination of fieldnames, like WHERE A.category=B.the_category WHERE A.category=B.catID If that does not work for you.... look up the array sort functions. Best also do a search in the webpage from this list (see ww.php.net -> emaillists -> archive), look for array and sort.

« previous php.general (#141847) next »