Solved

BIg Fobar need Help SQL staement needed for dsign flaw

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

Free Webinar: AWS Backup & DR

Join our upcoming webinar with experts from AWS, CloudBerry Lab, and the Town of Edgartown IT to discuss best practices for simplifying online backup management and cutting costs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Upgrade SQL Server 2014 Standard Edition from SQL Server 2012 Standard Edition 14 37
SQL Query Task 11 43
SQL 2014 missing dll from Bin? 3 32
SQL query 7 14
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

756 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