如果我有以下这些表格:
球员
ID Name
== ===========
1 Mick
2 Matt
教练员
ID Name
== ===========
1 Bill
2 Don
我在下面有一个脚本来查找所有包含“名称”列的表:
SELECT t.name AS table_name FROM sys.tables AS t
INNER JOIN sys.columns c ON t.OBJECT_ID = c.OBJECT_ID
WHERE c.name LIKE 'Name'
它返回以下内容:
table_name
===========
PLAYERS
COACHES
如何从上面查询返回的两个表中选择所有行?