Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Select Update Query Help Expand / Collapse
Author
Message
Posted Wednesday, April 07, 2010 8:57 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, December 06, 2011 11:09 AM
Points: 148, Visits: 331
Hi,

I have a query that joins two tables and takes the client_id from both tables and displays them next to each other.

What I need to do based on my WHERE clause is update the q.client_id with the values in c.client_id and trying to build a query to do that is doing my brain in.

Can anyone shed some light on the best way to achieve this? I would display all my failed attempts but that might not be helpful

Thanks for looking.


select c.company,q.createtime, Q.emp_FIRST_NAME, q.emp_lastname, q.client_id, c.client_id as contact_client_id from wce_contact c inner join wce_qualifications q on c.uniqueid = q.entityid where not c.client_id = q.client_id


Post #898600
Posted Wednesday, April 07, 2010 9:05 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, December 06, 2011 11:09 AM
Points: 148, Visits: 331
I just figured it with some help.

This is what i needed


Update q
Set q.client_id = c.client_id
From wce_contact c
inner join wce_qualifications q
on c.uniqueid = q.entityid
where not c.client_id = q.client_id


Post #898610
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse