Highlighted

Help with a update query from a subquery

New Here ,
Feb 20, 2015

Copy link to clipboard

Copied

Hello All,

I wanted to see if someone can help me with an update query.

I need to grab a latitude & longitude from a the same user that is in two accounts. therefore i am trying to update lat/long in a users table for one account based off of the same user in another account. I am matching the users up by phone number and last name. I tried a subquery but am having difficulty.

I was thinking of something like the following:

update users

set lat = getlat, long = getlong

inner join (select lat as getlat, long as get long from users where account_id = '1')

on phone = phone and last name = lastname

where account_id = '2' and lat IS NULL and long IS NULL

Am I going in the right direction???

Thanks in advance for any assistance!!!!

Views

346

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Help with a update query from a subquery

New Here ,
Feb 20, 2015

Copy link to clipboard

Copied

Hello All,

I wanted to see if someone can help me with an update query.

I need to grab a latitude & longitude from a the same user that is in two accounts. therefore i am trying to update lat/long in a users table for one account based off of the same user in another account. I am matching the users up by phone number and last name. I tried a subquery but am having difficulty.

I was thinking of something like the following:

update users

set lat = getlat, long = getlong

inner join (select lat as getlat, long as get long from users where account_id = '1')

on phone = phone and last name = lastname

where account_id = '2' and lat IS NULL and long IS NULL

Am I going in the right direction???

Thanks in advance for any assistance!!!!

Views

347

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Feb 20, 2015 0
haxtbh LATEST
Advocate ,
Feb 20, 2015

Copy link to clipboard

Copied

What difficulty are you having? Have you tried what you posted and get an error?

Although someone may be able to give you sql advice here, I would try posting this over at Stack Overflow as its not really related to Coldfusion.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 20, 2015 0