Hi..
I have the following table
tbl1
tid primary key int
catid numeric(5)
product_id numeric(5)
tmonth varchar(255)
values
tid catid product_id tmonth
1 1 1 January
2 1 1 February
3 2 1 April
4 2 1 May
6 3 1 Quarter1
7 3 1 Quarter2
I want the output to be :
tid catid product_id tmonth
2 1 1 February
3 2 1 May
7 3 1 Quarter2
The above result is similar to running a query like this..
select tid,catid,product_id,max(t
month) from tbl1 group by catid,product_id,tid <--??
BUT it wont work because , max(tmonth) is not correct... and group by tid is not correct!!!!
Please provide the correct query...
(IT should be in a single select statement)
Start Free Trial