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 field set value from selecting another table field's value..
Sun, Nov 18 2007 5:05 PMPermanent Link

"Hüseyin Aliz"
Hi,

I am not sure if this can be done but i would like to update a table field's
value by using a value from another table. This is what i need:

update "items.dat"
set items.stock = (select ordered-sent from "orderdet.dat" where orderno =
1000)
where items.itemid = 'ABC'
and items.itemid = orderdat.itemid

Hope it's clear what i want. I can do it in pascal code, but would be easier
if it can be done with SQL.

Thanks in advance,
Regards,
Hüseyin

Sun, Nov 18 2007 6:17 PMPermanent Link

"Robert"
Change the seond select to be part of the where statement. I thik this is it
(untested, try it)

update "items.dat"
set items.stock = ordered-sent
from "items.dat", orderdat
where items.itemid = 'ABC'
and items.itemid = orderdat.itemid
and orderno =  1000


"Hüseyin Aliz" <haliz@consit.dk> wrote in message
news:F1BCC2A7-282B-4DEF-B3A2-6A4D787AB878@news.elevatesoft.com...
> Hi,
>
> I am not sure if this can be done but i would like to update a table
> field's value by using a value from another table. This is what i need:
>
> update "items.dat"
> set items.stock = (select ordered-sent from "orderdet.dat" where orderno =
> 1000)
> where items.itemid = 'ABC'
> and items.itemid = orderdat.itemid
>
> Hope it's clear what i want. I can do it in pascal code, but would be
> easier if it can be done with SQL.
>
> Thanks in advance,
> Regards,
> Hüseyin
>
>

Mon, Nov 19 2007 6:12 AMPermanent Link

"Hüseyin Aliz"
Thanks Robert,

Works great Smile

Regards,
Hüseyin

"Robert" <ngsemail2005withoutthis@yahoo.com.ar> skrev i en meddelelse
news:55EB1BCE-91B8-4904-9952-2240FC8AE8A2@news.elevatesoft.com...
> Change the seond select to be part of the where statement. I thik this is
> it (untested, try it)
>
> update "items.dat"
> set items.stock = ordered-sent
> from "items.dat", orderdat
> where items.itemid = 'ABC'
> and items.itemid = orderdat.itemid
> and orderno =  1000
>
>
> "Hüseyin Aliz" <haliz@consit.dk> wrote in message
> news:F1BCC2A7-282B-4DEF-B3A2-6A4D787AB878@news.elevatesoft.com...
>> Hi,
>>
>> I am not sure if this can be done but i would like to update a table
>> field's value by using a value from another table. This is what i need:
>>
>> update "items.dat"
>> set items.stock = (select ordered-sent from "orderdet.dat" where orderno
>> = 1000)
>> where items.itemid = 'ABC'
>> and items.itemid = orderdat.itemid
>>
>> Hope it's clear what i want. I can do it in pascal code, but would be
>> easier if it can be done with SQL.
>>
>> Thanks in advance,
>> Regards,
>> Hüseyin
>>
>>
>
>

Image