查询出wineid为85的结果集
select mw.[WineID],wine.[WineDesc] FROM [M9M10].[dbo].[wne_Wine] as wine,[M9M10].[dbo].[mch_MerchantWine] as mw where mw.WineID = wine.WineID and [MerchantID]in(105,35)
现在数据
需要得到结果
此sql 语句怎么写,求高人指点。
------解决方案--------------------select mw.[WineID],wine.[WineDesc] FROM [M9M10].[dbo].[wne_Wine] as wine,[M9M10].[dbo].[mch_MerchantWine] as mw where mw.WineID = wine.WineID and [MerchantID]in(105,35) and wine.WineID =85
------解决方案--------------------1楼的去哪里了,怎么显示不出来是不是404又要爆发了??
------解决方案--------------------select mw.[WineID],wine.[WineDesc] FROM [M9M10].[dbo].[wne_Wine] as wine,[M9M10].[dbo].[mch_MerchantWine] as mw where mw.WineID = wine.WineID and [MerchantID]in(105,35) and mw.WineID = 85
------解决方案--------------------select mw.[wineid],wine[winedesc]from [m9m10].[wine_wine] wine,
[m9m10][dbo].[mch_merchantwine] mw
where mw.wineid= wine.wineid and[merchantid]in (105,35)and mw.wineid=85
go
这个查询这么的简单,你居然不会?无语了
------解决方案--------------------select mw.[WineID],wine.[WineDesc] FROM [M9M10].[dbo].[wne_Wine] as wine,[M9M10].[dbo].[mch_MerchantWine] as mw where mw.WineID = wine.WineID and [MerchantID]in(105,35) and mw.WineID = 85
为啥不用join呢?
select mw.[WineID],wine.[WineDesc] FROM [M9M10].[dbo].[wne_Wine] as wine
left join [M9M10].[dbo].[mch_MerchantWine] as mw on mw.WineID = wine.WineID
where [MerchantID]in(105,35) and mw.WineID = 85