SELECT * smokemommon WHERE yanming=‘长城(盛世5号)‘ AND yearID=17
SELECT *,SUM(shuliang) FROM smokemommon WHERE yearID=17 GROUP BY yanming,leixing,yearID HAVING yearID=17
INSERT INTO smokecommonsum(YEAR,yearID,yanming,shuliang,danjia,guige,baozhuang,leixing)
SELECT YEAR,yearID,yanming,SUM(shuliang),danjia,guige,baozhuang,leixing FROM smokemommon
GROUP BY yanming,leixing
INSERT INTO USER(userID,userName,cooperate,TYPE) SELECT userID,userName,cooperate,TYPE FROM USER WHERE userID=222
DELETE FROM smokecommonsum WHERE yearID=17
SELECT * FROM smokecommonSum WHERE yearID=17
DELETE FROM smokemommon WHERE yearID<>17
DELETE FROM smokemommon WHERE yearID=17
DELETE FROM smokecommonSum WHERE (yanming,leixing) IN (SELECT yanming,leixing FROM smokecommonsum GROUP BY yanming,leixing HAVING COUNT(*)>1)
AND rowid NOT IN
smokemommon
UPDATE smokemommon SET shuliang=4 WHERE yanming=‘中南海(硬94mm浪漫风情)‘ AND leixing=‘真品卷烟‘ AND yearID=17 AND YEAR=2015