Results 1 to 3 of 3

Thread: Query Help

  1. #1
    Join Date
    Mar 2006
    Posts
    3

    Unanswered: Query Help

    I am tring to write a query to join 2 tables

    Table 1
    pid engineer week
    123 bob 4
    265 joe 3
    377 nick 5
    229 bob 5
    123 bob 1


    Table 2

    week startDate
    1 sept 1
    2 sept 8
    3 sept 15
    4 sept 22
    5 sept 29
    etc......

    If I want only the records where bob is engineer and the id is 113, then join with table2 so we get this:

    week eng pid
    1 bob 123
    2 --- ---
    3 --- ---
    4 bob 123
    5 --- ---

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Where is the id?

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  3. #3
    Join Date
    Mar 2006
    Posts
    3
    Don't need id. Figured it out. Thanks

    SELECT TimeLog.Engr,TimeLog.week,TimeLog.projectNumber,Ti meLog.id,TimeLog.projectID,TimeLog.hours,
    TimeLog.dateentered,TimeLog.market,TimeLog.year,Ti meLog.pid,weeks.week
    FROM weeks
    left join [dbo].timelog on weeks.week = timelog.week and TimeLog.Engr = @EngineerEng and @pid = timelog.pid
    order by weeks.week

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •