我正在进行如下连接查询:
SELECT * FROM Clothes AS C
JOIN Style AS S on C.StyleId = S.SylelId
WHERE ClothesId = '19'
但我不想从Style中选择一切 我想从衣服(20排)中选择一切 并且只从Style中选择1行(从10开始) 什么是最简单的方法来做到这一点,而无需从衣服中选择每一行(有20件事可供选择),如:
SELECT C.Id, C.Description, C.Name, C.Size, C.Brand, S.Name FROM Clothes AS C
JOIN Style AS S on C.StyleId = ST.SylelId
WHERE ClothesId = '19'
最快的方法是什么?或者这是唯一的可能性
答案 0 :(得分:1)
将表名添加到*
SELECT C.*, S.Name as StyleName
FROM Clothes AS C
JOIN Style AS S on C.StyleId = S.SylelId
WHERE ClothesId = '19'
如果两个表中都有相同的名称,则必须至少使用其中一个别名来区分它们。