[TriLUG] MySQL INSERT syntax problem

Michael Rulison 13miketele at bellsouth.net
Mon Dec 4 21:17:39 EST 2006


I am wrestling poorly with MySql syntax and something I am just overlooking.

Query below has two parts: insert and select.
Insert is to put 3 fields for about 138 records into p_coin_invoices.
Separately, select works fine; together they do not tango.
The DATE_ADD function has been tested separately and works.
Error message follows the query.
Any comments welcome.
Thanks,
-----------------------------------------------------------------------------
Michael Rulison      |     919/782-9576
3256 Lewis Farm Road   Raleigh  NC  27607-6723

-----------------------------------------------------------------------------
================================================
 INSERT IGNORE p_coin_invoices( invc_cl_id, invc_ts, invc_ts_due )
VALUES (
cl_id, next_billing_date, date_add( next_billing_date, INTERVAL 21
DAY )
)
SELECT cl_id, cl_user_name, name, next_billing_date
FROM p_coin_clients, cust_extract
WHERE cust_extract.name = p_coin_clients.cl_user_name
AND next_billing_date < '2006-12-01'

 MySQL said: Documentation
#1064 - 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 'SELECT cl_id, cl_user_name, name, next_billing_date
FROM p_coin_clients, cust_e' at line 6




More information about the TriLUG mailing list