Solved

BIg Fobar need Help SQL staement needed for dsign flaw

Posted on 2007-04-11
1
250 Views
Last Modified: 2010-03-19
Little bit a design flaw found i want go into it.

I need a SQL fix for some data manipulation.

Where Query1 JOBID  =   JOBID in Querry2  AND CLIENTID (Querry 1) = CompanyID (Querry2)

Then ClientID (Querry1) = SitesID in Querry 2

A total mind F**T i know Hellllpppp



Querry 1

SELECT tblDocumentRevision.DocumentRevisionID, tblCTR.JobID, tblDocumentRevision.ClientID
FROM (tblCTR INNER JOIN tblDocRegister ON tblCTR.CTRID = tblDocRegister.CtrId) INNER JOIN tblDocumentRevision ON tblDocRegister.DocID = tblDocumentRevision.DocID
WHERE (((tblDocumentRevision.ClientID) Is Not Null))
ORDER BY tblCTR.JobID;


Querry 2

SELECT tblJob.JobID, tblSites.CompanyID, tblSites.SitesID
FROM tblJob RIGHT JOIN tblSites ON tblJob.JobID = tblSites.JobID
ORDER BY tblJob.JobID;

0
Comment
Question by:ellandrd
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 39

Accepted Solution

by:
appari earned 500 total points
ID: 18889638
try this

update tblDocumentRevision
set ClientID = tblSites.SitesID
from tblDocumentRevision INNER JOIN
(tblCTR INNER JOIN tblDocRegister ON tblCTR.CTRID = tblDocRegister.CtrId)
ON tblDocRegister.DocID = tblDocumentRevision.DocID
 join (tblJob RIGHT JOIN tblSites ON tblJob.JobID = tblSites.JobID)
on tblCTR.JobID = tblJob.JobID and
tblDocumentRevision.ClientID = tblSites.CompanyID
where tblDocumentRevision.ClientID Is Not Null
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question