NinjaTaktikz Posted July 14, 2011 Share Posted July 14, 2011 SELECT SUM(IF(increment_day < '2010-06-01',SUM(vdat_2992.counts),SUM(vdat_2449.clicktositeindicator))) as CTS FROM ( SELECT * FROM vdat_2874 WHERE increment_day >= '2010-06-01' UNION SELECT * FROM vdat_2992 WHERE increment_day <= '2010-06-01' ) detail WHERE campaignid IN (1633605) I keep getting error saying Category Timestamp Duration Message Line Position Error 7/14/2011 12:00:44 PM 0:00:11.875 <link> - MySQL Database Error: Unknown column 'vdat_2992.counts' in 'field list' 1 0 What am I doing wrong. I even gave the database table in front of the column. Please Help. Thank You Gary Quote Link to comment https://forums.phpfreaks.com/topic/242013-table-missing/ Share on other sites More sharing options...
requinix Posted July 14, 2011 Share Posted July 14, 2011 The only table referenced in that query is "detail". There is neither a "vdat_2992" nor a "vdat_2449". Are you missing a couple JOINs? Quote Link to comment https://forums.phpfreaks.com/topic/242013-table-missing/#findComment-1242897 Share on other sites More sharing options...
fenway Posted July 15, 2011 Share Posted July 15, 2011 No, the OP is still referring to the derived table aliases that dont' exist. Quote Link to comment https://forums.phpfreaks.com/topic/242013-table-missing/#findComment-1243040 Share on other sites More sharing options...
ebmigue Posted July 16, 2011 Share Posted July 16, 2011 @OP Perhaps, SELECT SUM(IF(increment_day < '2010-06-01',SUM(detail.counts),SUM(detail.clicktositeindicator))) as CTS FROM ( SELECT * FROM vdat_2874 WHERE increment_day >= '2010-06-01' UNION SELECT * FROM vdat_2992 WHERE increment_day <= '2010-06-01' ) detail WHERE campaignid IN (1633605) will do? Hope it helps. Quote Link to comment https://forums.phpfreaks.com/topic/242013-table-missing/#findComment-1243355 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.