Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.mysql > #522

Re: join with three tables

From Jerry Stuckle <jstucklex@attglobal.net>
Newsgroups comp.databases.mysql
Subject Re: join with three tables
Date 2011-04-07 06:42 -0400
Organization A noiseless patient Spider
Message-ID <ink4ep$d5$1@dont-email.me> (permalink)
References <da554007-3dbd-4082-88a4-a5b0dc1aca76@w7g2000yqe.googlegroups.com>

Show all headers | View raw


On 4/7/2011 3:19 AM, mada suresh wrote:
> 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@attglobal.net
==================

Back to comp.databases.mysql | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

join with three tables mada suresh <madudatabase@gmail.com> - 2011-04-07 00:19 -0700
  Re: join with three tables Jerry Stuckle <jstucklex@attglobal.net> - 2011-04-07 06:42 -0400
  Re: join with three tables "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2011-04-07 13:09 +0200
    Re: join with three tables onedbguru <onedbguru@yahoo.com> - 2011-04-07 19:22 -0700

csiph-web