Re: What's Unknown error 944?
Posted in 2000
So what you're looking for is
select pri.id, pri.amount, sec.text from primary pri, secondary sec
where sec.id = pri.id;
?
In article <395217D3.D146E1B3@NOSPAMnembv.cz>,
Milos Prudek <prudek@NOSPAMnembv.cz> wrote:
> 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)
>
> --
> Milos Prudek
>
--
# unrm /
ksh: unrm: not found
# man cpio
Sent via Deja.com http://www.deja.com/
Before you buy.