Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2005 > SQL Server 2005
|
SQL Server 2005 General discussion of SQL Server *2005* version only.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 25th, 2009, 03:06 PM
Registered User
 
Join Date: Dec 2008
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default query tables in 2 different databases

I have this query that has gotten quite messy. i know what i want to say, but havent been able to tie it together.
i would like to query a few tables in the EPPSGlobalProd and LogItProd databases that have relationships and select records that match any one of the criteria (should i have used 'or') or tear this thing down and rebuild

SELECT DISTINCT p.person_id,
p.last_name,
p.first_name,
o.name
FROM security_user_office_assignment s, office o, person p INNERJOIN clean_cut_experience c ON p.person_id = c.person_id
INNER JOIN cri_experience r ON p.person_id = r.person_id
INNER JOIN desorption_tech_experience d ON p.person_id = d.person_id
INNER JOIN dwm_wellsite_experience w ON p.person_id = w.person_id
INNER JOIN fluids_experience f ON p.person_id = f.person_id
INNER JOIN pressure_control_equipment_experience s ON p.person_id = s.person_id
INNER JOIN rdf_experience x ON p.person_id = x.person_id
INNER JOIN speedwell_experience n ON p.person_id = n.person_id
where p.adguid = s.adguid and s.office_id = o.office_id
order by o.name



thank you





Similar Threads
Thread Thread Starter Forum Replies Last Post
using arrays for tables in databases Karla Visual Basic 2005 Basics 1 August 5th, 2008 02:11 PM
Link tables from two different SQL Databases Folorunso Agbeja SQL Server 2000 1 October 19th, 2006 08:23 AM
How can I merge two databases and tickets tables? drarem Access VBA 2 October 5th, 2004 01:07 PM
Comparing tables from two Databases lguzman Access VBA 1 May 11th, 2004 05:11 PM
How 2 query tables from 2 different SQL7 databases mcp SQL Server ASP 3 June 5th, 2003 08:32 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.