Paste this into a new question or an answer at dba.stackexchange.com:
<!-- --> > CREATE TABLE 廠商編碼 > ([PIN碼] int, [編碼] varchar(3), [廠牌] nvarchar(5)) > ; > > INSERT INTO 廠商編碼 > ([PIN碼], [編碼], [廠牌]) > VALUES > (123, 'A01', N'蘋果'), > (123, 'A03', N'蘋果'), > (456, 'B11', N'花碩'), > (456, 'B12', N'花碩'), > (789, 'C77', N'三興'), > (789, 'C78', N'三興'), > (789, 'C79', N'三興'), > (789, 'C80', N'三興') > ; > > select * from 廠商編碼 > GO > > <pre> > PIN碼 | 編碼 | 廠牌 > -----: | :----- | :----- > 123 | A01 | 蘋果 > 123 | A03 | 蘋果 > 456 | B11 | 花碩 > 456 | B12 | 花碩 > 789 | C77 | 三興 > 789 | C78 | 三興 > 789 | C79 | 三興 > 789 | C80 | 三興 > </pre> *db<>fiddle [here](https://dbfiddle.uk/?rdbms=sqlserver_2017&fiddle=bbc5e07cc4538d3df98a54a6f27c4b41)*
back to fiddle