Reply to Re: Insert Subqueries

Your name:

Reply:


Posted by pltaylor3 on 07/06/06 16:30

thanks for your reply...the names are legacy. Just trying to make it
more functional.
Stu wrote:
> The syntax you are looking for is:
>
> INSERT INTO tblPartLocation (PartLocation, Part)
> SELECT 999, PartID
> FROM tblParts
> WHERE PartName = 'test'
>
> However, you may also want to reexamine your schema. Don't use tbl as
> a prefix for your tables; it's redundant, and unnecessary. Also, you
> have a column named Part in one table, but you're inserting the values
> of PartID from another table. If the columns represent the same thing,
> why don't you name them the same?
>
> HTH,
> Stu
>
>
> pltaylor3@gmail.com wrote:
> > I have tried this insert comand and it errors out telling me that i
> > cannot use subqueries this way. INSERT INTO tblPartLocation
> > (PartLocation, Part)VALUES (999,(SELECT PartID FROM tblParts WHERE
> > PartName = 'test'))
> >
> > how would i insert a value from a query?
> >
> > thanks for any help

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация