Left join query
am 30.05.2009 05:52:40 von bharani kumar
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=gcdmg-mysql-2@m.gmane.org
Re: Left join query
am 31.05.2009 07:17:40 von Shiv
--0016e644d02cd6b6e9046b2e6d3e
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
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
>
>
--0016e644d02cd6b6e9046b2e6d3e--
RE: Left join query
am 02.06.2009 03:06:53 von Gavin Towey
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 =3D C.Code
WHERE A.status =3D 1 and C.status =3D 1 and C.type =3D '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 =3D 1 and common
> table status =3D 1 and common table type =3D 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=3Dshivamy@gmail.com
>
>
The information contained in this transmission may contain privileged and c=
onfidential information. It is intended only for the use of the person(s) n=
amed above. If you are not the intended recipient, you are hereby notified =
that any review, dissemination, distribution or duplication of this communi=
cation is strictly prohibited. If you are not the intended recipient, pleas=
e 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
To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dgcdmg-mysql-2@m.gmane.o rg