nasty SQL query, please advise...
- From: "swansnow" <schultz@xxxxxxxxxxxxxxxxxxxxxxx>
- Date: 20 Sep 2005 06:53:55 -0700
Three tables: clients, coverage, visits
A client may have one or more coverages. A coverage may have one or
more visits.
Clients pk: clientID
coverage pk: covID, fk:clientID
visits pk: visitID, fk:covID
The query is this:
The visits table needs to store the client number for the client whose
visit this is for (don't ask why...)
I'm not sure how to express the SQL. Here's a beginning:
UPDATE visits
SET clientnum = (SELECT clientID from clients c
LEFT JOIN coverage v on c.clientID = v.clientID
LEFT JOIN visits t on v.covID = t.covID
WHERE .....???? )
I don't know what to put in the WHERE clause.
-Corinna
.
- Follow-Ups:
- Re: nasty SQL query, please advise...
- From: Maarten Wiltink
- Re: nasty SQL query, please advise...
- Prev by Date: Re: Help for use a DLL
- Next by Date: Re: nasty SQL query, please advise...
- Previous by thread: save frame from mediaplayer
- Next by thread: Re: nasty SQL query, please advise...
- Index(es):
Relevant Pages
|
|