Computer Science Canada mysql |
Author: | octopi [ Mon Jun 05, 2006 6:35 pm ] |
Post subject: | mysql |
hey, I need a little help, lets see if anyone knows the answer. I have two tables, one named 'p' with fields p_id, and p_name the other 'f' with f_id, p_id, f_name I need to insert a row into f, I know the following information p_name, and f_name is there anyway (using only mysql) to do this? basically I need to find out the p_id from from the p_name, adn then insert this value into 'f' along with f_name. (I want to do this with just mysql if possible), I don't want to use php to first select the value, and then use that and insert it. So does anyone know if you can do this? |
Author: | octopi [ Mon Jun 05, 2006 7:02 pm ] | ||
Post subject: | |||
I figured it out, if anyones interested here was the anwser (its more complicated than the simplified version I showed before)
basically, I just needed to add a select statemtent into the insert, and use single qoutes to specify the stuff that was no part of the select that needed to be inserted. |