---restore content starts---
[
This afternoon to accept an emergency small task, is a set of record statistics, the chess game player's two records in a row of the display, into the database after the first thought is the row to the column, but at the beginning felt wrong, and later wrote half really wrong, later on the Internet query for half a day more than a row of rows and more columns, Found to write algorithms and write functions, see the real headache, do not want to be so troublesome. So he suddenly brainwave, flashed a small idea, immediately implemented, is to add all the records preceded by an identity column num (row_number () function), and then use case to determine the parity line in the display, it is OK. Select Row_number () over (order by Drawid) as num,* from QPTreasureDB.dbo.RecordDrawScore wheredrawid in (select Drawid from QPTreasureDB.dbo.RecordDrawInfo where kindid= ' 400 '). Don't know if it's a little trick, share it with everyone.
Pasting
---restore content ends---
Multiple rows and columns in SQL multi-row and multiple column tips