Hi all,
I have a simple (hopefully) SQL question for you, any help would be much, much appreciated :).
I have two tables which I would like to join.
One Is Users, lets say it's called users
One is a kind of history of that user, lets say its called users_history.
The relationship of these two is a one users to many users_history relationship.
What I'd like to do is a query which joins the tables and joins the newest record in users_history onto each user.
Lets say the tables are like this, I'm simplifying for conciseness.
users
- id
- name
users_history
- id
- user_id
- date
The date is formatted YYYYMMDD.
The end result is I'd like to be able to pull out all of the users who don't have a users_history record for today, for example today is 20101021.
Any help would be very gratefully received! :)