sql - Table return the result of two rows in one -
this question has answer here:
if have table this:
matchcode transferid ---------- ----------- 17edce4d 7 17edce4d 17 20332cf0 22 20332cf0 30
is possible make result return this?
matchcode transferid1 transferid2 ---------- ----------- ----------- 17edce4d 7 17 20332cf0 22 30
if each matchcode
group have 2 records, can use min
, max
along group by
:
select matchcode, min(transferid) transferid1, max(transferid) transferid2 yourtable group matchcode
Comments
Post a Comment