1:创建view时如果两个表中有重名,那么可以给他们设置别名,如c.`name` advertiser_name.
SELECT c.`name` advertiser_name, c.`phone` advertiser_phone, c.`mail` advertiser_mail, c.`address` advertiser_address, p.`advertisementID`, p.`consumePerUserLimit`, p.`sharePerUserLimit`
FROM advertisement p, advertiser c
where c.`advertiserID` = p.`advertiserID`;
2:创建view是可以继续引用其他的view,如引用上边创建的view
SELECT a.`advertiser_name`, a.`advertiser_phone`, a.`advertiser_mail`, a.`advertiser_address`, a.`advertisementID`, a.`consumePerUserLimit`, a.`sharePerUserLimit`, g.`name`, g.`nickName`, g.`iconPath`, g.`imgPath`, g.`exchangeStepCounts`, g.`introduction`, g.`isRecommended` FROM advertisementAndAdvertiser a, gongZhongHaoInfo g
where a.`advertisementID` = g.`advertisementID`;
时间: 2024-10-01 07:24:20