我在我的一个 PHP 应用程序中使用了这个查询:
SELECT DictSchemeName.schemeName, DictTableName.tableName
FROM DictSchemeName, DictTableName
WHERE DictSchemeName.Id = (SELECT schemeName
FROM ServiceSublayer
WHERE sId = 3
AND ServiceId = (SELECT Id
FROM Service
WHERE applicationId = 'prga'))
AND DictTableName.Id = (SELECT tableName
FROM ServiceSublayer
WHERE sId = 3
AND ServiceId =(SELECT Id
FROM Service
WHERE applicationId = 'prga'));
如您所见,我将几乎相同的查询翻了两次(DictSchemeName 和 DictTableName),我刚开始学习 SQL,如果有人可以帮助我,我会非常高兴。
我正在使用 MS SQL SERVER 2008