How can I extract the required data from these three tables using mysql? -


sorry i'm struggling work out correct sql extract required data these 3 tables...

users:- id, firstname, lastname, email, live contracts:- id, userid, contractid userstage:- id, userid, stageid, statusid 

i need firstname, lastname, email, live, users , contractid contracts, , statusid userstage

where users.live =1 , contracts.contractid = 1 , userstage.statusid <>4 (not equal 4) 

thank you.

it's pretty basic sql. don't see problem is. might want change outer join (left or right) depending on need.

select u.firstname, u.lastname, u.email, u.live, c.contractid, us.statusid users u inner join contracts c on u.id = c.userid inner join userstage on u.id = us.userid u.live = 1 , c.contractid = 1 , us.statusid <> 4 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -