Re: If`s in MySQL.... Having some trouble here...
| From: | CC Zona | Date: | Fri, 16 Mar 2001 12:42:44 +0000 |
| Subject: | Re: If`s in MySQL.... Having some trouble here... | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-7545@lists.php.net to get a copy of this message | ||
In article <MIBBLBJEKKHMEDHENEKCOEIOCEAA.webmaster@port-industry.com>,
webmaster@port-industry.com ("Trond Erling Hundal") wrote:
> I want to query two tables in my db. One containing a list of numbers
> ranging from 10000 - 10200, the other table is storing information that is
> relative to some of the numbers:
>
> Eks:
> Table1.record1: number=10000
>
> Table2.record1: number=10000 name=John
>
> Now I want to query these to tables to show a table that has one column with
> the numbers, and if there is a name stored in the other table for this
> number, I want to display this.
Try:
select table1.number as num, name FROM table1
left join table2 using (number)
--
CC