Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread dbisam to elevatedb Update SQL Help
Wed, May 26 2010 6:49 PMPermanent Link

George

I need to convert the following dbIsam Statement into elevatedb script,

update myNewCompanyTable
set BusinessType=b.CompanyDesc,
CustomerServicePhone=b.Phone,
taxID=b.RefTaxID, website=b.wwwdata

from myNewCompanyTable as a

left outer join OldCompanyTable as b
on a.companyID=b.companyID

How can this be done?  Thanks in advance for any suggestion/help.
..
G Patena


Thu, May 27 2010 3:31 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Untested but something along the lines of

update myNewCompanyTable a
set BusinessType= (SELECT CompanyDesc FROM OldCompanyTable b WHERE b.companyID = a.CompanyID),
CustomerServicePhone=(SELECT Phone FROM OldCompanyTable b WHERE b.companyID = a.CompanyID),
taxID= (SELECT RefTaxID FROM OldCompanyTable b WHERE b.companyID = a.CompanyID),
website=(SELECT wwwdata FROM OldCompanyTable b WHERE b.companyID = a.CompanyID)

I'm not sure if you need to use different table identifiers in each sub select statement or not

Roy Lambert [Team Elevate]
Thu, May 27 2010 2:20 PMPermanent Link

George

> Untested but something along the lines of
>
> update myNewCompanyTable a
> set BusinessType= (SELECT CompanyDesc FROM OldCompanyTable b WHERE
> b.companyID = a.CompanyID),
> CustomerServicePhone=(SELECT Phone FROM OldCompanyTable b WHERE
> b.companyID = a.CompanyID),
> taxID= (SELECT RefTaxID FROM OldCompanyTable b WHERE b.companyID =
> a.CompanyID),
> website=(SELECT wwwdata FROM OldCompanyTable b WHERE b.companyID =
> a.CompanyID)
>
> I'm not sure if you need to use different table identifiers in each sub
> select statement or not
>
> Roy Lambert [Team Elevate]

It works!  I used the table identfiers.  Thanks Roy.

Image