Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread Update file(field) with Value of another file(field)
Wed, Jul 23 2014 10:43 PMPermanent Link

Ben Sprei

CustomEDP

I tried executing this query:
Update BVTF a
set a.CustID = (Select b.CustID from Lines b
                 where b.TN = a.TFNumber)
where a.CustID is NULL


and I received this error
ElevateDB Error #1011 An error occurred with the query (SELECT ALL
"b"."CustID" AS "CustID" FROM "Lines" AS "b" WHERE "b"."TN" =
"a"."TFNumber") (A scalar query can only return a single value)

CustID is an integer field
TN and TFNumber ar VarChars

What is the correct way to write this.

Thanx
Ben
Thu, Jul 24 2014 4:05 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Ben


The problem is that your sub-select is returning more than  one row. If this is expected then you can force a single row by the use of RANGE or possibly DISTINCT.

Firstly I'd run the sub-select as a stand alone query and find what its actually producing.

Roy Lambert
Thu, Jul 24 2014 1:23 PMPermanent Link

Ben Sprei

CustomEDP

Thanks .  Select distinct did it

"Roy Lambert"  wrote in message
news:1061BFB3-C39A-4CA2-AD89-A1D7C6206C87@news.elevatesoft.com...

Ben


The problem is that your sub-select is returning more than  one row. If this
is expected then you can force a single row by the use of RANGE or possibly
DISTINCT.

Firstly I'd run the sub-select as a stand alone query and find what its
actually producing.

Roy Lambert
Image