关于sql server产品详细信息页面的查询[英] Query regarding to sql server Product Detail page

本文是小编为大家收集整理的关于关于sql server产品详细信息页面的查询的处理方法,想解了关于sql server产品详细信息页面的查询的问题怎么解决?关于sql server产品详细信息页面的查询问题的解决办法?那么可以参考本文帮助大家快速定位并解决问题。

问题描述

嗨!
我有产品页面,我从中选择产品并重定向到产品页面.
加入后我得到了正确的详细信息,但我在产品功能表上有.它只有
两个领域.一个是ProductId,另一个是ProductFeatureId

我只想获得具有所有功能的单一产品.

以下是我的查询:

SELECT p.ProductName, p.Detail, p.StartingDate, p.ClosingDate, p.BidPrice, p.BidIncrement, p.Model, p.ProductImage, p.RegisterNo, p.IsAvailable, p.Status,c.CityName、com.CompanyName、s.StateName、cn.CountryNameFROM tblProduct AS p LEFT OUTER JOINtblCategory AS cat ON p.CategoryId = cat.CategoryId LEFT OUTER JOINtblCompany AS com ON p.CompanyId = com.CompanyId LEFT OUTER JOINtblCity AS c ON p.CityId = c.CityId LEFT OUTER JOINtblState AS s ON c.StateId = s.StateId LEFT OUTER JOINtblCountry AS cn ON s.CountryId = cn.CountryId

还有这些表连接剩余:
ProductFeature----->产品 ID、功能 IDFeatureId -------->FeatureId,FeatureName

如何加入

推荐答案

SELECT p.ProductName, p.Detail, p.StartingDate, p.ClosingDate, p.BidPrice, p.BidIncrement, p.Model, p.ProductImage, p.RegisterNo, p.IsAvailable, p.Status,
c.CityName, com.CompanyName, s.StateName, cn.CountryName
FROM tblProduct AS p,tblCategory AS cat,tblCompany AS com,tblCity AS c,
tblState AS s,tblCountry AS cn INNER JOIN
ON p.CategoryId = cat.CategoryId INNER JOIN
ON p.CompanyId = com.CompanyId INNER JOIN
ON p.CityId = c.CityId INNER JOIN
ON c.StateId = s.StateId INNER JOIN
ON s.CountryId = cn.CountryId

本文地址:https://www.itbaoku.cn/post/1355913.html