Max + Decode's wonderful. (Record Group).

xiaoxiao2021-03-06  117

=================================================== Condition: Tablename: MaterialField Name: Serial_Number , group_name, lot_idDate Example: 1 10001, MB_MD, MBID0000012 10001, TVE_MD, TVEID0000013 10001, MODEM_MD, MODEMID0000014 10002, MB_MD, MBID0000025 10002, TVE_MD, TVEID0000026 10002, MODEM_MD, MODEMID0000027 10003, MB_MD, MBID0000038 10003, TVE_MD, TVEID0000039 10003, MODEM_MD ModeMID000003 =================================================== SQL: SELECT Serial_Number, Max (decode (group_name, 'mb_md', lot_id, '')) MB_MD,

Max (decode (group_name, 'tve_md', lot_id, '')) TVE_MD,

Max (decode (group_name, 'modem_md', lot_id, '')) modem_md

From material

Group by serial_number =================================================== Result: Serial_Number MB_MD TVE_MD Modem_md10001, MBID000001, Modemid0000010002, Modemid000002, Tveike

转载请注明原文地址:https://www.9cbs.com/read-100855.html

New Post(0)