当前查询:
$query = sprintf("
SELECT compdetails.compname, compdetails.message, specdetails.expirydate,
specdetails.specday, specdetails.specname, specdetails.specorig, specdetails.specspec,
specdetails.startdate, complocations.address, complocations.lat, complocations.lng
FROM compdetails, complocations, specdetails
WHERE compdetails.compid='%s'
AND specdetails.compid='%s'
AND complocations.compid='%s'",
所以:
Compdetails表:compname消息
规格表:到期日规格日规格名称规格表规格起始日期配置表:地址纬度
我遇到的问题是:
从此视图中删除重复对象。看图片
我只需要列出以下内容之一:
1. compname message2。每个地址的到期日,指定日期,指定名称,指定价格,指定价格,开始日期
3.每个地址的经度
我希望这是有道理的
请帮忙。
最佳答案
SELECT compdetails.compname, compdetails.message, specdetails.expirydate,
specdetails.specday, specdetails.specname, specdetails.specorig, specdetails.specspec,
specdetails.startdate, complocations.address, complocations.lat, complocations.lng
FROM compdetails, complocations, specdetails
WHERE compdetails.compid='%s'
AND specdetails.compid='%s'
AND complocations.compid='%s'
GROUP BY compdetails.compname"
如果您想显示所有行但忽略某些行的某些值,则必须在视图中使用逻辑。