Home > database > AB two sets of data, how to use a SQL implementation will be two fields all related data classified
AB two sets of data, how to use a SQL implementation will be two fields all related data classified
Time:09-26
A list of existing test contains two fields idA and idB, how to use a SQL implementation will be two fields all related id as a set of output, Example: IdA idB A, B A, B B D D G F H F J Expected results: No id 1 A 1 B 1 D 1 G 2 F 2 H 2 J
Use: AS WITH XXX ( . Union all . ) select * from XXX. A large number of duplicate data would appear, is there any solution?
CodePudding user response:
Don't use union all don't want to have a repeat it with the union