locked
access help RRS feed

  • Question

  • User-2123122692 posted

    Hello,

    I have a weird situation with my access tables. here they are:

    Table 1

    fname       lname             dept
    Tom           Doe                 Accounting
    Mary          Smith              Admin
    Anna         Davis               CustomerService
    Berry         Strawberry      Accounting
    Joanna      Gait                 CustomerService
    Jim             Brown              Admin


    Table 2

    Full                         Hours Worked

    Tom Doe                     40
    Mary Smith                 30
    Anna Davis                  35
    Berry Strawberry          40
    Joanna Gait                 30
    Jim Brown                   20


    Let's say I only needed those from the accounting department. How can I write my statement to
    accomplish the following

    Full                           Dept                    Hours Worked
    Tom Doe                     Accounting                  40
    Berry Strawberr          Accounting                  40


    THANKS!

    Thursday, November 11, 2010 3:30 PM

Answers

  • User-1675817941 posted

    hi,

     this may helps,

     select  a.fname&' '&lname as  [fullname],a.dept, b.hoursworked from table1 a, table2 b

    where fullname=b.full and a.dept='Accounting'

    thanks,

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, November 15, 2010 2:25 AM

All replies

  • User-775831949 posted

    join fname & lname first then join 2 tables

     

    Sunday, November 14, 2010 11:36 PM
  • User-1675817941 posted

    hi,

     this may helps,

     select  a.fname&' '&lname as  [fullname],a.dept, b.hoursworked from table1 a, table2 b

    where fullname=b.full and a.dept='Accounting'

    thanks,

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, November 15, 2010 2:25 AM