Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Database > SQL Language
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language 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
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 24th, 2007, 11:14 AM
Registered User
 
Join Date: May 2007
Location: , , .
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Preventing repetition with Distinct?

Whenever I add a table in my query designer and checkmark Links it causes the guest names to be repeated. If I don't do this the query result is correct. So how do I prevent name repetition but yet add links to the display?

Current Code:

SELECT DISTINCT GuestName, GuestDescription FROM T_ProgramGuests WHERE (ProgramID = 9734)

Link Added to Code:

SELECT DISTINCT T_ProgramGuests.GuestName, T_ProgramGuests.GuestDescription, T_ProgramLinks.URL
FROM T_ProgramGuests CROSS JOIN T_ProgramLinks WHERE (T_ProgramGuests.ProgramID = 9734)

Even if I use a Left Outer Join I get the same.
Reply With Quote
  #2 (permalink)  
Old May 28th, 2007, 05:54 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

What is the Column with which you are making the join between T_ProgramGuests and T_ProgramLinks tables? How about posting the structure of the tables here?

_________________________
- Vijay G
Strive for Perfection
Reply With Quote
  #3 (permalink)  
Old May 29th, 2007, 11:47 AM
Authorized User
 
Join Date: Oct 2005
Location: , , .
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
Default

To only get one record, make sure that there is only one record in your T_ProgramLinks table. If there are multiple records in that table which have different URL values, then you have to put a JOIN condition or a WHERE clause that will return just 1 URL value.

SQL Server Helper
How well do you know SQL? Find out with the free test assessment from SQL Server Helper!!!
http://www.sql-server-helper.com/free-test/default.aspx

Got a SQL Server Question? Ask us here: http://www.sql-server-helper.com/forums/default.asp
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
Combobox shows me repetition of entries... sat_u2 VB.NET 2002/2003 Basics 4 January 14th, 2008 02:51 PM
Help!!::XSLT Transformation to remove repetition i techno_savvy81 XML 0 September 19th, 2007 05:01 AM
Preventing Hotlinking simtrade Classic ASP Professional 0 October 14th, 2005 05:06 PM
Distinct SELECT DISTINCT question... EndEffect Classic ASP Databases 4 August 18th, 2005 08:53 AM
Data report dont'want repetition haahoou VB Databases Basics 3 January 25th, 2004 05:00 AM



All times are GMT -4. The time now is 12:16 AM.


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