I have a table called Product Variant.
sequence No item
400 1 4.5
500 1 0
501 1 0
502 1 0
503 1 B-DP
504 2 0
400 1 2.5
500 2 0
501 2 0
502 2 0
503 2 B-PP
504 2 0
My Required output is :
sequence No item item1
503 1 B-DP 4.5
503 2 B-PP 2.5
I am trying but not coming as expected.. Can anyone suggest me on this please.
Thanks in Advance.
Something like this?
select max(case when item like 'B%' then sequence end),
no,
sum(try_convert(numeric(38, 6), item1))
from t
group by no;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.