If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > SQL Query Help

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-12-11, 13:31
ozzii ozzii is offline
Registered User
 
Join Date: Mar 2007
Posts: 194
SQL Query Help

Hi,

I have a table called tbl_users.
Code:
Id | Name         | Date_Registered      | Company_Name
____________________________________________________
1  | name_x       | 2011-02-01 16:44:17  | company_1
2  | name_y       | 2011-02-02 15:34:17  | company_2
3  | name_z       | 2011-02-02 15:34:17  | company_1

How do I select only those users that registered first from each company?

so the from the above table only users 1 and 2 should be retreived.
Reply With Quote
  #2 (permalink)  
Old 02-12-11, 15:01
ozzii ozzii is offline
Registered User
 
Join Date: Mar 2007
Posts: 194
I've found my solution on the following thread.

distinct by column and ordered by date?

Thanks r937!
Reply With Quote
  #3 (permalink)  
Old 02-12-11, 19:18
r937 r937 is online now
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,535
Quote:
Originally Posted by ozzii View Post
Thanks r937!
hey, you're welcome
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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