Conversion from row to Column
--- Create table tb (name varchar (10), subject varchar (10), result int); insert into tb values ('zhang san', 'China', 74 ); insert into tb values ('zhang san', 'mat', 83); insert into tb values ('Li si', 'China', 80 ); insert into tb values ('Li si', 'mat', 86); select * from tb; ----- output format: ---- name, Chinese Mathematics, Zhang San, 74 83, Li Si 80 86 select name, sum (case when subject = 'China' then result end) as language, sum (case when subject = 'mate' then result end) as mathematics from tbgroup by name; View Code
After four months of employment, I found that my SQL was not very advanced. I often made many mistakes when talking to the boss about things. Make up your mind to write SQL statements, improve your work efficiency, and work less overtime. After returning to the registration in the evening, I did not use CSDN. I answered a simple question.
Although anxious, the ability is too impatient. Keep confidence and go up slowly.