trouble with a join.

Results 1 to 2 of 2

Thread: trouble with a join.

  1. #1
    Join Date
    Dec 1969

    Default trouble with a join.

    I have an Access database with two tables from which I am pulling information.<BR>One table, tbl_Dates, contains each date in the schedule and a second<BR>table, tbl_Times, which contains the time slots for each date. <BR><BR>My SQL statement looks as follows...<BR><BR>SELECT * FROM tbl_Dates INNER JOIN tbl_Times ON tbl_Dates.DateID =<BR>tbl_Times.DateID ORDER BY tbl_Dates.fDate, tbl_Times.AMPM,<BR>tbl_Times.Time ASC;<BR><BR>My problem comes when there are records in the tbl_Dates table that<BR>doesn&#039;t have matching records in the tbl_Times table. <BR><BR>Any idea how I can change my SQL statement to get those dates to show<BR>even though there are no time slot data for those dates? Ideally I want<BR>to make one SQL call to the database, hence the reason for joining the<BR>two tables.

  2. #2
    Join Date
    Dec 1969

    Default RE: trouble with a join.

    Use a left join to get all the records from the table on left side of join<BR>even if there are none on right side...<BR><BR>So change your<BR>INNER JOIN<BR>To<BR>LEFT JOIN<BR><BR>and you should be ok.

Posting Permissions

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