SQL Query Modification Help Request PT4

  • Hello Community
    The following SQL Script will compare TablesA and TableB for a match in column columns A & B and if it finds a match will produce the following result:

    with cmn as (
      select
        a.a
      from TableA a
      inner join TableB b on a.b = b.b and a.c = b.c
      and a.b = 'bb'
      )
    select 1 as is_deleted, a.* from TableA a inner join cmn on a.a = cmn.a
    union all
    select 0 as is_deleted, b.* from TableB b inner join cmn on b.a = cmn.a

    So looking at the two tables you will see that there are 3 instances / records of cc in TableB and there is one record of cc in TableA in column A respectively.
    TableB

    TableA

    After modification of the sql script I would like the expected the result to look like:

    Can someone help with that request.
    I have attached the tables in .txt format (not xls)

    Thanks

  • Please post the code you have written in a effort to solve your problem and what problem(s) you are encountering with your code.
    Having looked at your other posts it seems obvious to me that you really haven't done much in an effort to solve your problem(s) and are simply looking for free consulting/tutorial help without actually asking for such.  If you want real help demonstrate that you are actually trying to solve these problems you are posting.

  • You have been pointed to an article that tells you the correct way to post data multiple times. (it's the first link in my signature and also Lynn's signature.)  You haven't put in the effort to follow that advice, which only reinforces the impression that you're looking for someone to do free consulting for you.  Thanks, but no thanks.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply