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 > Find Last Status

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-30-04, 03:25
piulibero piulibero is offline
Registered User
 
Join Date: Dec 2003
Location: Athens,GR
Posts: 16
Find Last Status

I HAVE A TABLE LIKE THIS

ID CUSTOMERID NAME
-------------------------------------
1 12345 JOHN
2 12345 JOHN
3 56789 ANGELO
4 56789 ANGELO
5 56789 ANGELO
6 56789 ANGELO
7 87654 TIM
8 87654 TIM
9 87654 TIM

I WANT EACH TIME TO HAVE THE LAST VALUE FOR EACH CUSTOMER,FOR EXAMPLE HERE I WANT TO HAVE LINES 2,6,9
I DONT KNOW HOW TO USE KOIN VERY GOOD NEITHER THE MAX STATEMENT
THANK YOU
Reply With Quote
  #2 (permalink)  
Old 03-30-04, 09:52
willi.st willi.st is offline
Registered User
 
Join Date: Feb 2004
Location: Vienna/Austria
Posts: 7
assuming your tablename is 'customer':

SELECT MAX(id) AS maxid, name FROM customer
GROUP BY name ORDER BY maxid

Willi
Reply With Quote
  #3 (permalink)  
Old 03-31-04, 10:36
piulibero piulibero is offline
Registered User
 
Join Date: Dec 2003
Location: Athens,GR
Posts: 16
Quote:
Originally posted by willi.st
assuming your tablename is 'customer':

SELECT MAX(id) AS maxid, name FROM customer
GROUP BY name ORDER BY maxid

Willi
Dear Willy,

thank you for your reply.
my table looks like:
ID CUSTOMERID NAME
-------------------------------------
1 12345 JOHN
2 12345 JOHN
3 56789 ANGELO
4 56789 ANGELO
5 56789 ANGELO
6 56789 ANGELO
7 87654 TIM
8 87654 TIM
9 87654 TIM

the outcome i'd desire is like this:

2 12345 JOHN
6 56789 ANGELO
9 87654 TIM


thank you
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