Hi all.
Hi spam filter. SQL. Query.

I'm trying to append data to a table ( Powertel_CCD_LineList ) if it doesn't already exist in the table:

insert into Powertel_CCD_LineList
( AccountNo, ServiceNumber, ServiceNumberDescription )
select
Powertel_CCD_CallDetails.AccountNo,
Powertel_CCD_CallDetails.ServiceNumber,
Powertel_CCD_CallDetails.ServiceNumberDescription
from
Powertel_CCD_CallDetails left join Powertel_CCD_LineList
on Powertel_CCD_CallDetails.ServiceNumber=Powertel_CCD_LineList.ServiceNumber
where
Powertel_CCD_LineList.DanPK is null
group by
Powertel_CCD_CallDetails.AccountNo,
Powertel_CCD_CallDetails.ServiceNumber,
Powertel_CCD_CallDetails.ServiceNumberDescription


If I run the query minus the 'insert into' bit, it runs fine.
But when I run it _with_ the 'insert into' bit, I get:

ERROR 1066: Not unique table/alias: 'Powertel_CCD_LineList'

Please don't tell me I have to select into a tmp table first, and then back into the original...
So do I?


--
Daniel Kasak
IT Developer
* NUS Consulting Group*
Level 18, 168 Walker Street
North Sydney, NSW, Australia 2060
T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989
email: [EMAIL PROTECTED]
website: www.nusconsulting.com


--------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



Reply via email to