SQL Server Performance

SQL Server Reporting Service Question

Discussion in 'Getting Started' started by beyondpluto, May 4, 2007.

  1. beyondpluto New Member

    Here's my scenario. I have created two tables within a report. Let's say TABLE 1 has 100 items FOR SALE. And let's say that TABLE 2 lists 10 items that are SOLD.
    What I'm trying to do is create a report that eliminates duplicates. In effect, I want to create a table with 90 items. I have joined the tables by item number, but evidently I'm using the wrong syntax (or tactic) to delete the dupes. Any thoughts, earthlings? Much thanks for any suggestions.
  2. MohammedU New Member

    If understand your problem correctly...!!

    select * from Table1 t1
    where not exists (select 1 from Table2 t2 where t1.itemnumber = t2.itemnumber)

    to delete from table1

    delete t1
    from table1 t1
    join table2 t2 on t1.itemnumber = t2.itemnumber

    MohammedU.
    Moderator
    SQL-Server-Performance.com

    All postings are provided “AS IS” with no warranties for accuracy.
  3. satya Moderator

    You need a query and not a report, you can embed same query within the reporting services report.

    Satya SKJ
    Microsoft SQL Server MVP
    Writer, Contributing Editor & Moderator
    http://www.SQL-Server-Performance.Com
    This posting is provided AS IS with no rights for the sake of knowledge sharing. The greatest discovery of my generation is that a human being can alter his life by altering his attitudes of mind.

Share This Page