Home > database >  A column turned SQL
A column turned SQL

Time:12-02

Column turned and item and the number of item_name
 
The CREATE TABLE # A (code VARCHAR (30), the name VARCHAR (200),
Item1 VARCHAR (30), item_name1 VARCHAR (100),
Item2 VARCHAR (30), item_name2 VARCHAR (100))
INSERT INTO # A
SELECT '1001', 'A1001', 'W01', 'W011001', 'W03', 'W011003' UNION ALL
SELECT '1002', 'D1001', 'K01', 'K011001', 'P09', 'P011009' UNION ALL
SELECT '1003', 'G1001', 'M01', 'M011001', 'N03', 'N011003'


Results: column line breaks
Code item item_name
1001 W01 W011001
1001 W03 W011003
1002 K01 K011001
1002 P09 P011009
1003 M01 M011001
1003 N03 N011003
  • Related