Re: Combining INSERT...SELECT and INSERT INTO

From: Date: Mon, 14 Jan 2002 12:48:07 +0000
Subject: Re: Combining INSERT...SELECT and INSERT INTO
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-15758@lists.php.net to get a copy of this message
Markus, Off hand, I don't know. Just try it -- you're not really going to break anything and may come up with something we can all use. About 12 years ago I was working for a sewer and water contractor, which built a number of "interesting" projects. Before starting with them I assumed they just knew how to build them. I was wrong. If they only built what they knew their business would have shrivelled and died. They grew by building what many other contractors considered undoable, and got premium prices. When I struck out on my own that was the lesson I took with me. And it's a tough one, because I generally like to know how things will turn out before I finish. Several years ago I was 30% of the way into a project in VB when it became very clear that for what I wanted to do VB just didn't have the capabilities. So it was back to FoxPro for Windows and successful completion. Fortunately the client was understanding. So, it's a good question. But sometimes we just have to try these things. If Rasmus et. al. hadn't we wouldn't have PHP today. Cheers, and please let us know how it works out - Miles At 12:54 PM 1/14/2002 +0200, Markus Lervik wrote:
Hello! It's me again, with the magazine database : ) Is there any way to combine INSERT...SELECT and INSERT INTO so one could insert a new row with a few values inserted by hand and others from another table? something like INSERT INTO mag_table (mag_id,issn,year,info,volume,numbers,remarks) VALUES ( (SELECT id FROM mag_names WHERE mag_names.name="Asdf"), "1234-5678","2001","foobar","1-4","1-52","foobar"); I'm trying to construct myself a nice clever INSERT statement to my web-frontend. Haven't got it to work, though. Is this even possible? The other option would be to use three(?) mysql_query calls from my PHP-code, but I'd like to keep it as simple as possible. Cheers, Markus -- Markus Lervik Linux-administrator with a kungfoo grip Vaasa City Library - Regional Library markus.lervik@vaasa.fi +358-6-325 3589 / +358-40-832 6709 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net For additional commands, e-mail: php-db-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net


« previous php.db (#15758) next »