Connecting Tech Pros Worldwide Help | Site Map

select from 2 tables and

Newbie
 
Join Date: Mar 2009
Posts: 1
#1: Mar 9 '09
Hello, im new to mysql and i could find anything on the internet to help me so ill post my q here.

First im running mysql 5.0.67. I have to tables

allusers:
-id_user
-help
-team_user
-own_emal

players:
-id_player
-name_player
-owner_name
-owner_id
-owner_team_id

So this is my 2 tables. What im trying to do is reading from this tables to look if id_user is the same number with owner_team_id , and if it is the same show only stats that is from specific user

Thank you
Michael
mwasif's Avatar
Moderator
 
Join Date: Jul 2006
Location: Pakistan
Posts: 718
#2: Mar 10 '09

re: select from 2 tables and


I didn't understand you completely. Are you looking for this?
Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM allusers users 
  2. INNER JOIN players p ON p.owner_team_id = users.id_user
  3. WHERE users.id_user = 'some user id here'
Member
 
Join Date: Dec 2007
Posts: 47
#3: Jun 30 '09

re: select from 2 tables and


If you give those two columns the same name you could use something like this..

Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM users  
  2. LEFT JOIN players USING (id_user)
  3. WHERE id_user = 'user id' 
  4.  
Reply