Re: What's Unknown error 944?
Posted in 2000
From: Milos Prudek <prudek@NOSPAMnembv.cz>
>
>I have two tables.
>
>TABLE PRIMARY.
>structure: id,amount,text
>contents:
>id amount text
>1 2
>1 3
>2 6
>2 3
>3 2
>3 6
>
>TABLE SECONDARY
>structure: id,text
>contents:
>id text
>1 one
>1 oonnee
>2 two
>2 ttwwoo
>
>Now, I need to fill in text in PRIMARY.text. SECONDARY does not contain
>all
>ids, so some text in PRIMARY will remain empty. And SECONDARY contain
>duplicite ids, so I want to always use first available value.
>
>FIRST ATTEMPT:
>
>UPDATE primary
>SET text=(SELECT text FROM secondary s WHERE s.id=primary.id)
>WHERE primary.id IN (select s.id FROM secondary s)
>
>This gives error 284: A subquery has returned not exactly one row.
>
>SECOND ATTEMPT:
>UPDATE primary
>SET text=(SELECT text FROM secondary s WHERE s.id=primary.id)
>WHERE primary.id IN (select first 1 s.id FROM secondary s)
>
>This gives 944: Unknown error message -944.
>
>Please help me.
>
>Actually I do not neet to update the PRIMARY table. I would be happy if
>PRIMARY structure was simply (id,amount) and if I could just SELECT
>(id,amount,text)
I'm sure their are more elegant ways of doing this, but how about
SELECT id, amount, "SOME STRING AS LONG AS YOUR TEXT FIELD" text
FROM primary
INTO TEMP paulwatson;
UPDATE paulwatson
SET text = (SELECT FIRST 1 text FROM secondary
WHERE secondary.id = paulwatson.id);
SELECT * FROM paulwatson;
NOTE: Untested, I only have SE Linux on my box at home, and that doesn't
like SELECT FIRST anything. So I can't get past that.
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com