Newbee Question 
Author Message
 Newbee Question

I can do basic queries, but I have run into a situation where I can't find
an example to start from.

Two Tables A and B  They have a one to one relationship on a field named
OpportunityID.  I need to update a value in Table B based on a value in
Table A.

So, in plain english I want to Locate all records that have a specified
value in FieldY in table A, Locate the Matching OpportunityID's in table B
and update   FieldX  in table B to a specified value.

I know how to construct a simple update query and I have created nested
select queries, I also understand Joins, but I can't get a handle on the
syntax for this one.

Any nudges in the right direction would be appreciated.

--
Scott Holmes



Wed, 08 Feb 2006 21:22:27 GMT
 Newbee Question

UPDATE TableB
 SET X = 'SOMETHING X'
 WHERE EXISTS
  (SELECT *
    FROM TableA
    WHERE Y='SOMETHING Y' AND opportunityid = TableB.opportunityid)

--
David Portas
------------
Please reply only to the newsgroup
--


Quote:
> I can do basic queries, but I have run into a situation where I can't find
> an example to start from.

> Two Tables A and B  They have a one to one relationship on a field named
> OpportunityID.  I need to update a value in Table B based on a value in
> Table A.

> So, in plain english I want to Locate all records that have a specified
> value in FieldY in table A, Locate the Matching OpportunityID's in table B
> and update   FieldX  in table B to a specified value.

> I know how to construct a simple update query and I have created nested
> select queries, I also understand Joins, but I can't get a handle on the
> syntax for this one.

> Any nudges in the right direction would be appreciated.

> --
> Scott Holmes



Wed, 08 Feb 2006 21:43:05 GMT
 Newbee Question
Thanks David!

--
Scott Holmes

Quote:
> UPDATE TableB
>  SET X = 'SOMETHING X'
>  WHERE EXISTS
>   (SELECT *
>     FROM TableA
>     WHERE Y='SOMETHING Y' AND opportunityid = TableB.opportunityid)

> --
> David Portas
> ------------
> Please reply only to the newsgroup
> --



> > I can do basic queries, but I have run into a situation where I can't
find
> > an example to start from.

> > Two Tables A and B  They have a one to one relationship on a field named
> > OpportunityID.  I need to update a value in Table B based on a value in
> > Table A.

> > So, in plain english I want to Locate all records that have a specified
> > value in FieldY in table A, Locate the Matching OpportunityID's in table
B
> > and update   FieldX  in table B to a specified value.

> > I know how to construct a simple update query and I have created nested
> > select queries, I also understand Joins, but I can't get a handle on the
> > syntax for this one.

> > Any nudges in the right direction would be appreciated.

> > --
> > Scott Holmes



Thu, 09 Feb 2006 02:30:29 GMT
 
 [ 3 post ] 

 Relevant Pages 

1. dynamic sql - newbee question

2. Newbee question

3. Newbee question

4. Access -> Server 7 - Newbee question

5. HELP explain SQL licensing!! Newbee Question...Sorry

6. Newbee Question

7. newbee question:

8. newbee question?

9. Newbee question

10. Newbee question

11. newbee question (urgent)

12. NewBee question


 
Powered by phpBB® Forum Software