Current location: Hot Scripts Forums » Other Discussions » Database » SQL Query question


SQL Query question

Reply
  #1 (permalink)  
Old 06-12-07, 01:34 PM
adubb adubb is offline
Newbie Coder
 
Join Date: Jan 2005
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
SQL Query question

I have 2 tables

login and member

the login table has

ID, username, password, type

the other one holds the information of a user

So like...

ID, firstname, lastname, address, login_id

I want to query so that i can display all the members and their info

My current query is this:
sql Code:
  1. SELECT DISTINCT(lo.ID),lo.username, me.F_name, me.L_name, me.Address, me.Email, me.Phone, me.reg_date, me.payment_date, me.STATUS FROM login lo,member me WHERE lo.type = '1'  GROUP BY lo.ID
but it seems like its pulling up the information from only one of the members info, for every ID in the login table

what would be the proper way to join this?
Reply With Quote
  #2 (permalink)  
Old 06-12-07, 01:41 PM
UnrealEd's Avatar
UnrealEd UnrealEd is offline
Community Liaison
 
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 3,165
Thanks: 4
Thanked 25 Times in 25 Posts
like you said: use a JOIN syntax :
SQL Code:
  1. SELECT * FROM login lo JOIN member me WHERE me.ID=lo.ID
i haven't tested it, but it should work

cheers
__________________
"Good judgement comes from experience, and experience comes from bad judgement." - Fred Brooks

Reply With Quote
  #3 (permalink)  
Old 06-12-07, 01:59 PM
adubb adubb is offline
Newbie Coder
 
Join Date: Jan 2005
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
You are the man with the PLAN, I was way over my head in that one. Thank-you much appreciated.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP- SQL Server..Query help.... cancer10 Database 3 01-31-07 06:11 AM
Question on sql query ajs PHP 1 03-10-05 04:27 AM
Declared Functions skipper23 PHP 4 12-17-03 10:06 AM
index page not showing up skipper23 PHP 3 12-15-03 01:10 PM
change my field in this example sal21 ASP 3 07-14-03 02:49 AM


All times are GMT -5. The time now is 04:58 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.