Help with SQL

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Stephen B. Burris Jr.

    #1

    Help with SQL

    I am having a problem coming up with the correct SQL string to take care
    of a issue. I have three tables (tblRoster, tblAssign, tblAppointment)
    All three have a field intSSN which is the primary key. I have been
    trying to figure out a SQL string to populate tblAssign with all the
    intSSN numbers that are in tblRoster while filtering out the numbers
    that are in tblAppointment.

    So in the end, if tblAppointment was appended to tblAssign I would have
    the contents of tblRoster

    Thanks in advance

    Stephen B. Burris Jr.
  • '69 Camaro

    #2
    Re: Help with SQL

    Hi, Stephen.
    I have been trying to figure out a SQL string to populate tblAssign with all
    the intSSN numbers that are in tblRoster while filtering out the numbers that
    are in tblAppointment.
    Try:

    INSERT INTO tblAssign
    SELECT R.intSSN, R.DOB
    FROM tblRoster AS R LEFT JOIN tblAppointment AS A ON R.intSSN= A.intSSN
    WHERE (ISNULL(A.intSS N));

    .. . . where intSSN and DOB are two columns in tblRoster and tblAssign tables
    (and you can list more columns in your query).

    HTH.
    Gunny

    See http://www.QBuilt.com for all your database needs.
    See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
    http://www.Access.QBuilt.com/html/ex...ributors2.html for contact info.


    "Stephen B. Burris Jr." <dark_knight159 @yahoo.comwrote in message
    news:evqdncgxE7 NHv-LYnZ2dnUVZ_revn Z2d@comcast.com ...
    I am having a problem coming up with the correct SQL string to take care of a
    issue. I have three tables (tblRoster, tblAssign, tblAppointment) All three
    have a field intSSN which is the primary key. I have been trying to figure
    out a SQL string to populate tblAssign with all the intSSN numbers that are in
    tblRoster while filtering out the numbers that are in tblAppointment.
    >
    So in the end, if tblAppointment was appended to tblAssign I would have the
    contents of tblRoster
    >
    Thanks in advance
    >
    Stephen B. Burris Jr.

    Comment

    • Stephen B. Burris Jr.

      #3
      Re: Help with SQL

      Thanks, that worked perfect

      Stephen B. Burris Jr.

      '69 Camaro wrote:
      Hi, Stephen.
      >
      >I have been trying to figure out a SQL string to populate tblAssign with all
      >the intSSN numbers that are in tblRoster while filtering out the numbers that
      >are in tblAppointment.
      >
      Try:
      >
      INSERT INTO tblAssign
      SELECT R.intSSN, R.DOB
      FROM tblRoster AS R LEFT JOIN tblAppointment AS A ON R.intSSN= A.intSSN
      WHERE (ISNULL(A.intSS N));
      >
      . . . where intSSN and DOB are two columns in tblRoster and tblAssign tables
      (and you can list more columns in your query).
      >
      HTH.
      Gunny
      >
      See http://www.QBuilt.com for all your database needs.
      See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
      http://www.Access.QBuilt.com/html/ex...ributors2.html for contact info.
      >
      >
      "Stephen B. Burris Jr." <dark_knight159 @yahoo.comwrote in message
      news:evqdncgxE7 NHv-LYnZ2dnUVZ_revn Z2d@comcast.com ...
      >I am having a problem coming up with the correct SQL string to take care of a
      >issue. I have three tables (tblRoster, tblAssign, tblAppointment) All three
      >have a field intSSN which is the primary key. I have been trying to figure
      >out a SQL string to populate tblAssign with all the intSSN numbers that are in
      >tblRoster while filtering out the numbers that are in tblAppointment.
      >>
      >So in the end, if tblAppointment was appended to tblAssign I would have the
      >contents of tblRoster
      >>
      >Thanks in advance
      >>
      >Stephen B. Burris Jr.
      >
      >

      Comment

      • '69 Camaro

        #4
        Re: Help with SQL

        You're welcome, Stephen. Glad it helped.

        Gunny

        See http://www.QBuilt.com for all your database needs.
        See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
        http://www.Access.QBuilt.com/html/ex...ributors2.html for contact info.


        "Stephen B. Burris Jr." <dark_knight159 @yahoo.comwrote in message
        news:8ZGdnWvMT4 hr8OLYnZ2dnUVZ_ u_inZ2d@comcast .com...
        Thanks, that worked perfect
        >
        Stephen B. Burris Jr.
        >
        '69 Camaro wrote:
        >Hi, Stephen.
        >>
        >>I have been trying to figure out a SQL string to populate tblAssign with all
        >>the intSSN numbers that are in tblRoster while filtering out the numbers
        >>that are in tblAppointment.
        >>
        >Try:
        >>
        >INSERT INTO tblAssign
        >SELECT R.intSSN, R.DOB
        >FROM tblRoster AS R LEFT JOIN tblAppointment AS A ON R.intSSN= A.intSSN
        >WHERE (ISNULL(A.intSS N));
        >>
        >. . . where intSSN and DOB are two columns in tblRoster and tblAssign tables
        >(and you can list more columns in your query).
        >>
        >HTH.
        >Gunny
        >>
        >See http://www.QBuilt.com for all your database needs.
        >See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
        >http://www.Access.QBuilt.com/html/ex...ributors2.html for contact info.
        >>
        >>
        >"Stephen B. Burris Jr." <dark_knight159 @yahoo.comwrote in message
        >news:evqdncgxE 7NHv-LYnZ2dnUVZ_revn Z2d@comcast.com ...
        >>I am having a problem coming up with the correct SQL string to take care of
        >>a issue. I have three tables (tblRoster, tblAssign, tblAppointment) All
        >>three have a field intSSN which is the primary key. I have been trying to
        >>figure out a SQL string to populate tblAssign with all the intSSN numbers
        >>that are in tblRoster while filtering out the numbers that are in
        >>tblAppointmen t.
        >>>
        >>So in the end, if tblAppointment was appended to tblAssign I would have the
        >>contents of tblRoster
        >>>
        >>Thanks in advance
        >>>
        >>Stephen B. Burris Jr.
        >>

        Comment

        Working...