当前查询:
$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
消息
详细说明表:
expirydate
specday
specname
specorig
specspec
startdate
complocations表:
地址
转载lng
我遇到的问题:
从此视图中删除欺骗。见图像
我只需要列出以下一次:
1. compname message
2。每个地址的expirydate,specday,specname,specorig,specspec,stardate
3. lat,lng每个地址
我希望这是有道理的
请帮忙。
答案 0 :(得分:0)
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"
如果您想要显示所有行但在某些行上省略某些值,则必须在视图中使用逻辑。