Have you looked at http://dev.mysql.com/doc/refman/5.0/en/insert-select.html ?

Cheers,
Tanner

On 12/4/06, Michael Rulison <[EMAIL PROTECTED]> wrote:
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

--
TriLUG mailing list        : http://www.trilug.org/mailman/listinfo/trilug
TriLUG Organizational FAQ  : http://trilug.org/faq/
TriLUG Member Services FAQ : http://members.trilug.org/services_faq/



--
Tanner Lovelace
clubjuggler at gmail dot com
http://wtl.wayfarer.org/
(fieldless) In fess two roundels in pale, a billet fesswise and an
increscent, all sable.
--
TriLUG mailing list        : http://www.trilug.org/mailman/listinfo/trilug
TriLUG Organizational FAQ  : http://trilug.org/faq/
TriLUG Member Services FAQ : http://members.trilug.org/services_faq/

Reply via email to