dbTalk Databases Forums  

SELECT PROBLEM

sybase.public.sqlanywhere.general sybase.public.sqlanywhere.general


Discuss SELECT PROBLEM in the sybase.public.sqlanywhere.general forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Mgs
 
Posts: n/a

Default SELECT PROBLEM - 09-16-2009 , 08:49 AM






Hi all,

I have the following table:

Col_id: integer autoincrement PK
Color_id: smallint

I insert a row in the table every time a color is used. So a
color can appear in the table once, never or a lot of times.
I would like to know what colors have been used BUT only the
last time they have been used. For example:

DATA
col_id Color_id
1 2
2 3
3 4
4 1
5 1
6 4
7 5
8 3

RESULT
Color_id Col_id
2 1
3 8
4 6
1 5
5 7

Thanks a lot in advance.

Reply With Quote
Reply




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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.