To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here

HOME News MS SQL Oracle DB2 Access MySQL PHP Scripts Books Links DBA Talk


Go Back   Database Journal Forums > Related Sites > SQL Course

SQL Course SQL Course > Ask questions about the lessons on SQL Course 1 and 2. If you have problems > with the interface, please post in the Feedback forum

Reply Post New Thread
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 12-28-2002, 02:42 PM
terrell terrell is offline
Junior Member
 
Join Date: Dec 2002
Posts: 1
eliminating rows from a return set - join problem

Hi:
I am trying to eliminate one of the rows where the linkID is duplicated. The record is different between the two rows with linkID = 1198.

Of course using distinct linkID doesn't work, or any other thing that I have tried. Is there a way to alter my query?

What other techique could I use if not?


QUERY:
***************************************
SELECT
l.linkID,
title,
t.linkTypeID,
t.sortingOrderMain,
t.sortingOrder,
lt.type

FROM links2 l, links_linkTypes2 t, linkTypes2 lt
WHERE l.linkID = t.linkID
AND t.linktypeID = lt.linktypeid
AND bMain =1
AND bApprove = 1
AND (
lt.linkTypeID = 20--@linkTypeID
OR
lt.parentID = 20--@linkTypeID
)
ORDER BY lt.sortingOrder, t.sortingOrderMain


RESULTS:
***************************************

linkID title linkTypeID sortingOrderMain sortingOrder type
----------- ----------------------------------- ---------- ------------------ ----
1048 Eugene City Charter 20 1 2 Eugene
1147 Eugene Land Use Application Info 20 2 4 Eugene
1168 EugeneCC-Agenda 20 3 5 Eugene
1191 Eugene-Spfld Transplan 20 4 8 Eugene
1198 Eugene Land Use Code 20 5 12 Eugene
1198 Eugene Land Use Code 24 6 999 Planning
1028 Eugene Wetlands Program 30 7 999 Wetlands
1008 Eugene Planning Division 24 8 2 Planning
Reply With Quote
  #2  
Old 12-31-2002, 07:52 AM
Steve_LL Steve_LL is offline
Junior Member
 
Join Date: Dec 2002
Location: London, ON - Canada
Posts: 6
I don't understand what you're asking. Is it how to isolate the row? If so, you have to make sure that the tables are joined properly and select the values that make the row unique...

select *
from links2 l inner join links_linkTypes2 t on l.linkID = t.linkID
inner join linkTypes2 lt on t.linktypeID = lt.linktypeid

where l.linkID = '1198'
and lt.type = 'Eugene'

to delete the row:

delete
from links2 l inner join links_linkTypes2 t on l.linkID = t.linkID
inner join linkTypes2 lt on t.linktypeID = lt.linktypeid
where l.linkID = '1198'
and lt.type = 'Eugene'

Does that help?
Reply With Quote
Reply Post New Thread

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 01:52 PM.


DatabaseJournal Recent Articles


 » Searching and Sorting Strings in Oracle

 » Preparing To Upgrade Access Tables to SQL ...

 » Sun Expands MySQL With Closed Source

 » Microsoft Demos New SQL Server Features at...

 » Wipro and Oracle Launch First Joint Innova...

Search Database Journal:
 





Acceptable Use Policy

JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers

Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.