我试图从临时表中获取唯一的mls行并将它们放入主表中,但GROUP BY给了我一些问题。非常感谢帮助。
INSERT into data (showing, price, mls, street, unit, showing_start, showing_end, agent, broker, telephone) SELECT showing, price, mls, street, unit, showing_start, showing_end, agent, broker, telephone from tmpdata where mls not in (SELECT mls from data) GROUP BY mls
答案 0 :(得分:0)
您是否尝试使用GROUP BY子句生成一组数据,以使每一行都具有唯一的MLS?如果MLS必须是唯一ID,则需要汇总所有其他字段。
实施例: INSERT .... SELECT MAX(显示),MAX(价格),mls,MAX(街道)......等等。