Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Select Distinct from one table

Posted on 2003-12-01
2
283 Views
Last Modified: 2009-12-16
Hello,

This should be farily easy but I just can't seem to get it.  I am tracking 404 errors on a web site in a table and reidrecting the user if the URL they are trying to reach exists in another table.  What I want to do basically is create a view that looks at the column in the table with the error log that contains the URL that users have tried to reach and compare that to the column in the table that contains redirct urls.  If the url in the log table does not appear in the table of redirects, I want all of the columns of data from that record in the log table to appear in the view.  I don't know if I'm making any sense or not.  Any help is greatly appreciated.

Thanks,

David
0
Comment
Question by:beegled
2 Comments
 
LVL 4

Accepted Solution

by:
BulZeyE earned 50 total points
ID: 9853539
So you are basically looking for something like:

SELECT *
  from tblLogError le
where not exists (select *
                           from tblURLRedirect ur
                          where ur.OrigUrl = le.ErrorUrl)

or

SELECT *
  from tblLogError le
where ErrorULR not in(select ur.OrigUrl
                           from tblURLRedirect ur)

?? is that what you want?  A little more info like table/column...??



0
 

Author Comment

by:beegled
ID: 9853735
That's exactly it!  Thanks so much.  I really appreciate it.

David
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question