MS SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMS SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 29th, 2003, 04:49 AM
williamcrawley williamcrawley is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: uk
Posts: 91 williamcrawley User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Help with complex query please

Hi All,

Here is my current statement:

SELECT au.AgencyID, au.UserID, au.StartDate, au.EndDate, f.IACS, f.VendorNo, f.CPH, ad.BusinessName, cn.Name
FROM dbo.Authority au INNER JOIN
dbo.User f ON au.UserID = f.ID INNER JOIN
dbo.Address ad ON f.AddrID = ad.ID INNER JOIN
dbo.ContactNames cn ON cn.AgencyID = au.AgencyID
WHERE (au.AgencyID = '201')

The above statement returns all Rows. The Authority table has Multiple records for an AgencyID/UserID combination However I want to reduce the total amount of records returned by only returning the 1st unique AgencyID/UserID combination. I'm having trouble making this complex query

Thanks

Reply With Quote
  #2  
Old October 29th, 2003, 04:18 PM
don_sparko's Avatar
don_sparko don_sparko is offline
Digitally Challenged
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 280 don_sparko User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 54 m 14 sec
Reputation Power: 6
could you show the table structure?
__________________
My brain cells are like a storm trooper's armor: useless

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMS SQL Development > Help with complex query please


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT