Re: insert using subquery

From: bill <william_at_TechServSys.com>
Date: Sat, 13 Aug 2016 07:29:54 -0400
Message-ID: <non0bm$q47$1_at_gioia.aioe.org>


On 8/13/2016 7:03 AM, bill wrote:
> I have a query that works:
>
> SELECT `transNum` FROM `transactions`
> where
> `description` LIKE 'Quality Reporting%'
>
> now I want to make it a subquery in order to insert transNum into
> another table
>
> insert into pendingInsBillings (transNum) Values (??)
> here (SELECT `transNum` FROM `transactions`
> where
> `description` LIKE 'Quality Reporting%')
>
> I just can't figure out what to replace the ?? with in the main
> query in order to get the value of transNum from the subquery.
>
> bill

I tried:
INSERT INTO `pendingInsBillings`(`transNum`) VALUES ((SELECT `transNum` FROM `transactions` where
`description` LIKE 'Quality Reporting%'))

but get the error 1242 Subquery returns more than 1 row (which is true) Received on Sat Aug 13 2016 - 13:29:54 CEST

Original text of this message