SQL Query Select first rank 1 row From Multiple ranks/Group
问题 I have following data Table1 id col1 col2 col3 ---------------------------------- 1 abc 01/01/2012 - 1 abc 01/01/2012 A 2 abc 01/01/2012 - 2 abc 01/02/2012 - 3 abc 01/02/2012 - 3 xyz 01/01/2012 - 4 abc 01/02/2012 - 4 xyz 01/01/2012 - 4 xyz 01/02/2012 - following is order to evaluate - if(col1 is false) then evaluate col2 if(col2 is false) then col3: Col1 - xyz has first preference from all values in this column col2 - min date col3 - not '-' or min(col3) I want to return only one row for each