During database design, sometimes attribute record values belonging to the same person are stored in multiple records for the purpose of data standardization, you want to merge multiple attribute data into one row for display. This is a row-to-column conversion. For example, the score table. 1. method 1 (Versions later than SQL2000) -- a total of 1.2 million records SE
During database design, sometimes attribute record values belonging to the same person are stored in multiple records for the purpose of data standardization, you want to merge multiple attribute data into one row for display. This is a row-to-column conversion. For example, the score table. 1. method 1 (SQL 2000 and later versions) -- a total of 1.2 million records SE
During database design, the US space sometimes uses multiple records to store the attribute record values of the same person for the purpose of data standardization, when displaying, you want to combine multiple attribute data into one row for display. This is a row-to-column conversion for the Hong Kong virtual host.
For example, the score table.
1. method 1 (SQL 2000 and later versions)
-- SELECT wbook_no, MAX (case when [COP_G_NO] = '000000' then ar end) "1.2 million ", MAX (case when [COP_G_NO] = '000000' then ar end) "50165814", MAX (case when [COP_G_NO] = '000000' then ar end) "10221553" FROM (SELECT [COP_G_NO], wbook_no, SUM (G_QTY * decl_Price) ARFROM WBK_PDE_LISTWHERE [COP_G_NO] in ('123456', '123456', '123456 ') group by [COP_G_NO], wbook_no) agroup by wbook_no