sql - Group by query advise -
in sql server, having table product below
manf prod id desc audi a1 1 tyre tye 1 audi a1 2 tyre type 2 audi a1 3 tyre type 3 bmw b1 4 tyre tye 1 bmw b1 5 tyre type 2 bmw b1 6 tyre type 3 toyota t1 7 tyre type 1
i want output group columns of manf , prod id should of values.. kindly advise query..
manf prod id audi a1 1 bmw b1 4 toyota t1 7
select manf, prod, min(id) id your_table group manf, prod
Comments
Post a Comment