|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
From: Gavin Towey (gtowey
ffn.com)
Date: Mon Jun 01 2009 - 20:06:53 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
A LEFT OUTER JOIN in that query in not necessary. An inner join should be used.
-----Original Message-----
From: Shiv [mailto:shivamy
gmail.com]
Sent: Saturday, May 30, 2009 10:18 PM
To: bharani kumar
Cc: mysql
Subject: Re: Left join query
Hi,
Along with tables, you should also provide details on how they are
related. Assuming "Code" is unique in both tables and left joined on
Airport table, you can do something like this
SELECT A.Code, C.Code, A.SlNo, C.SlNo, A.Name, C.Location, A.status,
C.status, C.type
FROM Airport A
LEFT OUTER JOIN Common C
ON A.Code = C.Code
WHERE A.status = 1 and C.status = 1 and C.type = 'airport'
Cheers,
Shiva
On Fri, May 29, 2009 at 8:52 PM, bharani kumar <
bharanikumariyerphp
gmail.com> wrote:
> Airport table
>
> SlNo Name Code Auth Location status
> 1 Chennai CHN Yes India 1
> 2. Hydarabed HYD Yes India 0
> 3 walker WAK Yes uk 1
>
>
> common table
>
> SlNo Name Code Type Location
> status
> 1 Chennai CHN Airport India
> 1
> 2. guest Road GR Seaport India 1
> 3. Hyderabad HYD Airport
> India 0
> 4. John garden JG Seaport India 0
> 5 walker WAK airport uk 1
>
>
> Hi All
>
> Can u please tell the query for the above table ,
>
> Display the record which satisfy below condtions ,
>
> 1.Need to display airport name , Where airport status = 1 and common
> table status = 1 and common table type = airport
>
> Output somthing like below
>
> AirportCode CommonCode AirportSlNo CommonSlNo AirportName
> CommonLocation Status Type
>
> CHN CHN 1 1
> Chennai india 1 airport
>
> WAK WAK 3 5
> walker uk 1 airport
>
>
> Any idea ,,,,,,,,,
>
>
>
>
> Thnaks
>
>
>
>
>
>
>
> --
> Regards
> B.S.Bharanikumar
> http://php-mysql-jquery.blogspot.com/
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe: http://lists.mysql.com/mysql?unsub=shivamy
gmail.com
>
>
The information contained in this transmission may contain privileged and confidential information. It is intended only for the use of the person(s) named above. If you are not the intended recipient, you are hereby notified that any review, dissemination, distribution or duplication of this communication is strictly prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]