Solved

BIg Fobar need Help SQL staement needed for dsign flaw

Posted on 2007-04-11
1
240 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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

Suggested Solutions

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
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…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

752 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