dbTalk Databases Forums  

join with three tables

comp.databases.mysql comp.databases.mysql


Discuss join with three tables in the comp.databases.mysql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
mada suresh
 
Posts: n/a

Default join with three tables - 04-07-2011 , 02:19 AM






hi friends ,,,
i want columns from three different
tables..here is my query..

select jp.js_id from js_profile jp join {select
js.js_id,js.js_email,ep.emp_email from js_login js join
emp_login ep on js.js_email=ep.emp_email} as hj on hj.js_id=jp.js_id;


the table js_login have js_id , js_email,
the table emp_login have emp_email, Now i want js_id for
js_email=emp_email.
from this result i want compare js_id with js_id in table
js_profile,,,,


help me,,,my query not working ,,,please help me

Reply With Quote
  #2  
Old   
Jerry Stuckle
 
Posts: n/a

Default Re: join with three tables - 04-07-2011 , 05:42 AM






On 4/7/2011 3:19 AM, mada suresh wrote:
Quote:
hi friends ,,,
i want columns from three different
tables..here is my query..

select jp.js_id from js_profile jp join {select
js.js_id,js.js_email,ep.emp_email from js_login js join
emp_login ep on js.js_email=ep.emp_email} as hj on hj.js_id=jp.js_id;


the table js_login have js_id , js_email,
the table emp_login have emp_email, Now i want js_id for
js_email=emp_email.
from this result i want compare js_id with js_id in table
js_profile,,,,


help me,,,my query not working ,,,please help me
What is "not working"? That's not very descriptive. And why are you
using a subselect? Why not just join the tables? This is just a guess,
but maybe something like:

SELECT jp.gs_id, js.js_id, js.js_email, ep.emp_email
FROM js_profile jp
JOIN js_login js ON jp.js_id = js_js_id
JOIN emp_login ep ON js.js_email = ep.emp_email

But I'm not really sure if that's what you want. The CREATE TABLE
statements with sample data and the output you expect would help.

It also is very helpful if you format your SQL sensibly like above -
makes it much more readable.


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex (AT) attglobal (DOT) net
==================

Reply With Quote
  #3  
Old   
Álvaro G. Vicario
 
Posts: n/a

Default Re: join with three tables - 04-07-2011 , 06:09 AM



El 07/04/2011 9:19, mada suresh escribió/wrote:
Quote:
i want columns from three different
tables..here is my query..

select jp.js_id from js_profile jp join {select
js.js_id,js.js_email,ep.emp_email from js_login js join
emp_login ep on js.js_email=ep.emp_email} as hj on hj.js_id=jp.js_id;
Did you read somewhere that you can use brackets or you are trying to
reverse engineer the SQL language?


--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--

Reply With Quote
  #4  
Old   
onedbguru
 
Posts: n/a

Default Re: join with three tables - 04-07-2011 , 09:22 PM



On Apr 7, 7:09*am, "Álvaro G. Vicario"
<alvaro.NOSPAMTH... (AT) demogracia (DOT) com.invalid> wrote:
Quote:
El 07/04/2011 9:19, mada suresh escribi /wrote:

* * * * * * * * * * * * i want columns from three different
tables..here is my query..

select jp.js_id from js_profile jp join {select
js.js_id,js.js_email,ep.emp_email from js_login js join
emp_login ep on js.js_email=ep.emp_email} as hj on hj.js_id=jp.js_id;

Did you read somewhere that you can use brackets or you are trying to
reverse engineer the SQL language?

--
--http://alvaro.es- lvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programaci n web:http://borrame.com
-- Mi web de humor satinado:http://www.demogracia.com
--


Not sure, but this looks suspiciously like someone's homework.. If it
is not homework, heaven help the company that hires this guy.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.