I want to do:
SELECT @Rate:=Rate FROM Project WHERE ProjectID = 'x';
INSERT INTO BillingTime (Start, End, ProjectID, Rate) values (a, b, x,
@Rate);
... but I'm sure its doable in a single query, even if I have multiple
values to query, is it?
INSERT INTO BillingTime (Start, End, ProjectID, Rate) SELECT a, b, x,
Rate FROM Project where ProjectID = x;
... but this doesn't work if I want to query values from multiple tables.
--
Michael T. Babcock
C.T.O., FibreSpeed Ltd.
http://www.fibrespeed.net/~mbabcock
---------------------------------------------------------------------
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
- re: Inserting value from other table in query Michael T. Babcock
- re: Inserting value from other table in query Egor Egorov