Re: What's up with this syntax?
- Original Message - From: Daniel Kasak [EMAIL PROTECTED] To: mysql@lists.mysql.com Sent: Wednesday, March 30, 2005 11:24 PM Subject: What's up with this syntax? update _cached_LinesNotTolling LNT inner join TelecomLinePosting TLP on LNT.Line=TLP.Line inner join TelecomAccountPosting TAP on TLP.TelecomLinePostingID=TAP.DanPK inner join PhoneTypes on TLP.LineType=PhoneTypes.ID set AnnualService=sum(TLP.Service)/1*12, LNT.PhoneType=SitRepDesc, MaxOfInvDate=InvDate where TAP.DanPK=41675 group by TLP.Line It's giving me: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'group by TLP.Line' Looks right to me... According to the manual - http://dev.mysql.com/doc/mysql/en/update.html - you can't put a GROUP BY in an UPDATE. Rhino -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.9.1 - Release Date: 01/04/2005 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
What's up with this syntax?
update _cached_LinesNotTolling LNT inner join TelecomLinePosting TLP on LNT.Line=TLP.Line inner join TelecomAccountPosting TAP on TLP.TelecomLinePostingID=TAP.DanPK inner join PhoneTypes on TLP.LineType=PhoneTypes.ID set AnnualService=sum(TLP.Service)/1*12, LNT.PhoneType=SitRepDesc, MaxOfInvDate=InvDate where TAP.DanPK=41675 group by TLP.Line It's giving me: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'group by TLP.Line' Looks right to me... -- Daniel Kasak IT Developer NUS Consulting Group Level 5, 77 Pacific Highway North Sydney, NSW, Australia 2060 T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989 email: [EMAIL PROTECTED] website: http://www.nusconsulting.com.au -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: What's up with this syntax?
On Wednesday, March 30, 2005 22:25, Daniel Kasak wrote: update _cached_LinesNotTolling LNT inner join TelecomLinePosting TLP on LNT.Line=TLP.Line inner join TelecomAccountPosting TAP on TLP.TelecomLinePostingID=TAP.DanPK inner join PhoneTypes on TLP.LineType=PhoneTypes.ID set AnnualService=sum(TLP.Service)/1*12, LNT.PhoneType=SitRepDesc, MaxOfInvDate=InvDate where TAP.DanPK=41675 group by TLP.Line It's giving me: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'group by TLP.Line' Looks right to me... Remove the group by. A group by is used to group rows returned by a select statement. -- Tom Crimmins Interface Specialist Pottawattamie County, Iowa -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: What's up with this syntax?
Tom Crimmins wrote: On Wednesday, March 30, 2005 22:25, Daniel Kasak wrote: update _cached_LinesNotTolling LNT inner join TelecomLinePosting TLP on LNT.Line=TLP.Line inner join TelecomAccountPosting TAP on TLP.TelecomLinePostingID=TAP.DanPK inner join PhoneTypes on TLP.LineType=PhoneTypes.ID set AnnualService=sum(TLP.Service)/1*12, LNT.PhoneType=SitRepDesc, MaxOfInvDate=InvDate where TAP.DanPK=41675 group by TLP.Line It's giving me: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'group by TLP.Line' Looks right to me... Remove the group by. A group by is used to group rows returned by a select statement. Doh! I need a sum(). I take it I have to do it in 2 steps then. -- Daniel Kasak IT Developer NUS Consulting Group Level 5, 77 Pacific Highway North Sydney, NSW, Australia 2060 T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989 email: [EMAIL PROTECTED] website: http://www.nusconsulting.com.au -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]