Query from two tables that looks for a missing value

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • silversubey
    New Member
    • May 2007
    • 22

    Query from two tables that looks for a missing value

    Hello,
    I have two tables: CltDue, Checklist

    SELECT CltDue.CDClient name, CltDue.CDID
    FROM CltDue
    WHERE CLtdue.CDstatus = 'More Client info reqst'

    shows the following:


    project#1 9579
    project#2 9956
    project#3 9946

    SELECT checklist.CDID, Checklist.page
    FROM Checklist
    shows the following

    9579 CLS
    9579 INFO
    9956 IRO2
    9956 SCC

    I am trying to query which projects from CltDue are missing an 'INFO' page from the Checklist table.
    If I try an = 'INFO' i only get results that have an INFO page. If I try <> 'INFO' I get everything else.

    Thank You
  • deepuv04
    Recognized Expert New Member
    • Nov 2007
    • 227

    #2
    Originally posted by silversubey
    Hello,
    I have two tables: CltDue, Checklist

    SELECT CltDue.CDClient name, CltDue.CDID
    FROM CltDue
    WHERE CLtdue.CDstatus = 'More Client info reqst'

    shows the following:


    project#1 9579
    project#2 9956
    project#3 9946

    SELECT checklist.CDID, Checklist.page
    FROM Checklist
    shows the following

    9579 CLS
    9579 INFO
    9956 IRO2
    9956 SCC

    I am trying to query which projects from CltDue are missing an 'INFO' page from the Checklist table.
    If I try an = 'INFO' i only get results that have an INFO page. If I try <> 'INFO' I get everything else.

    Thank You

    hi,

    try the following query ,probably will help you

    SELECT distinct CltDue.CDClient name, CltDue.CDID
    FROM CltDue
    WHERE CltDue.cdid not in (SELECT DISTINCT CDID FROM CHECKLIST WHERE PAGE = 'INFO')


    thanks

    Comment

    • silversubey
      New Member
      • May 2007
      • 22

      #3
      Works perfect!
      Thank you for the help.

      Comment

      Working...