Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM SQL » View Thread |
Messages 1 to 3 of 3 total |
Update field set value from selecting another table field's value.. |
Sun, Nov 18 2007 5:05 PM | Permanent 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 PM | Permanent 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 AM | Permanent Link |
"Hüseyin Aliz" | Thanks Robert,
Works great 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 >> >> > > |
This web page was last updated on Saturday, May 4, 2024 at 12:54 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |