Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Expert SQL Server 2005 Integration Services ISBN: 978-0-470-13411-5
This is the forum to discuss the Wrox book Expert SQL Server 2005 Integration Services by Brian Knight, Erik Veerman; ISBN: 9780470134115
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Expert SQL Server 2005 Integration Services ISBN: 978-0-470-13411-5 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old March 20th, 2009, 03:05 PM
Registered User
 
Join Date: Dec 2008
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default retrieving all records

i want to retrieve all records regardless if they were associated with an office or had person_id in the other 7 tables what do i need to add to this query to achieve this? presently the query retrieves 1200 records that have person_id in LogITProd.dbo.office, EPPSGlobalProd.dbo.person and any table in the case statement. there are 31000 records altogether.
thank you for all your help!




SELECT DISTINCT p.person_id,

p.last_name,

p.first_name,

o.name as office_name, g.BU,
case
when
count(c.clean_cut_experience_id) > 0
then 'X'
end clean_cut_experience,
case
when count(r.cri_experience_id) > 0
then 'X'
end cri_experience,
case
when
count(d. desorption_tech_experience_id) > 0
then 'X'
end desorption_tech_experience,
case
when
count(w.dwm_wellsite_experience_id) >0
then 'X'
end dwm_wellsite_experience,
case
when count( f.fluids_experience_id) > 0
then 'X'
end fluids_experience,
case
when count(pressure_control_equipment_experience_id) > 0
then 'X'
end pressure_control_equipment_experience,
case
when count(rdf_experience_id) > 0
then 'X'
end rdf_experience,

case
when count(speedwell_experience_id) > 0
then 'X'
end speedwell_experience,

case
when count(completion_procedures_experience_id) > 0
then 'X'
end completion_procedures_experience

FROM global_business_unit g
join LogITProd.dbo.office o on g.office_name = o.name
join LogITProd.dbo.security_user_office_assignment u on u.office_id = o.office_id
join EPPSGlobalProd.dbo.person p on p.ad_guid = u.ad_guid
left outer JOIN clean_cut_experience c ON p.person_id = c.person_id

left outer JOIN cri_experience r ON p.person_id = r.person_id

left outer JOIN desorption_tech_experience d ON p.person_id = d.person_id

left outer JOIN dwm_wellsite_experience w ON p.person_id = w.person_id

left outer JOIN fluids_experience f ON p.person_id = f.person_id

left outer JOIN pressure_control_equipment_experience s ON p.person_id = s.person_id

left outer JOIN rdf_experience x ON p.person_id = x.person_id

left outer JOIN speedwell_experience n ON p.person_id = n.person_id

left outer JOIN completion_procedures_experience e ON p.person_id = e.person_id
--where o.name ='Aberdeen'
group by p.person_id, p.last_name, p.first_name,o.name, g.BU


HAVING Count(c.clean_cut_experience_id)
+ Count(r.cri_experience_id)
+ Count(d.desorption_tech_experience_id)
+ Count(w.dwm_wellsite_experience_id)
+ Count(f.fluids_experience_id)
+ Count(pressure_control_equipment_experience_id)
+ Count(rdf_experience_id)
+ Count(speedwell_experience_id)
+ Count(e.completion_procedures_experience_id)
>0
order by o.name
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Retrieving records after upsizing database misskaos Classic ASP Basics 14 March 20th, 2007 09:55 AM
problem in updating records & finding records naveed77 VB Databases Basics 1 January 16th, 2007 11:12 AM
problem in updating records & finding records naveed77 VB How-To 1 January 16th, 2007 11:10 AM
retrieving fields louie001 ASP.NET 1.0 and 1.1 Basics 1 October 12th, 2005 01:28 PM
retrieving results adam69uk Dreamweaver (all versions) 1 February 16th, 2004 01:08 PM



All times are GMT -4. The time now is 09:51 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.