Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2005
    Posts
    2

    Question Unanswered: Help with left join

    Hi, I have 2 tables in Ms Access. I am doing a tasklist application. I am using left join because I want all the records in the left table to be displayed. I almost get what I want but there is one thing that I cant figure out how to do.

    Table name: SampleTask
    Column names: taskID (pk), taskTime, taskName, taskDescription, taskPictorial, Monday, Tuesay....Sunday

    Table name: SampleUser
    Column names: userID, taskID, timeCompleted, taskStatus, taskDate

    This is my sql statement of the left join..
    SELECT SampleTask.taskID, SampleTask.taskTime, SampleTask.taskName, SampleUser.userID, SampleUser.taskStatus FROM SampleTask LEFT JOIN SampleUser ON SampleTask.taskID = SampleUser.taskID WHERE " & strDay & " = true ORDER BY SampleTask.taskTime, SampleTask.taskID

    If i put.....WHERE " & strDay & " = true AND SampleUser.taskDate = '28/02/2005'.....then it will return me only the records with 28/02/2005. But that is not what I want.

    What I want to display is to show all the tasks for today with the userID regardless of whether they have a record in User if "taskDate = today's date"

    Any help would be great. Thank you in advance.

  2. #2
    Join Date
    Nov 2004
    Posts
    39
    Your statements are a bit confusing!
    you said that...
    If i put.....WHERE " & strDay & " = true AND SampleUser.taskDate = '28/02/2005'.....then it will return me only the records with 28/02/2005. But that is not what I want.
    What I want to display is to show all the tasks for today with the userID regardless of whether they have a record in User if "taskDate = today's date"
    I assume that "today's date" you are saying is 28/02/2005,
    I don't see anything wrong in the results returned:
    only the records with 28/02/2005.
    since this is the only date that will qualify to your condition/requirement:
    all the tasks for today with the userID regardless of whether they have a record in User if "taskDate = today's date"
    You must be very specific to what you want, or better give us illustration (sample set of records and the result you want).

    Red

  3. #3
    Join Date
    Feb 2005
    Posts
    2
    I have got the solution. Thanx anyway.

Posting Permissions

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