Jump to content

How do I write a statement to pull similar rows fm 2 tbls


tturner

Recommended Posts

Hi, I'm new to writing SQL, kind of learning on my own....My problem is I have two tables in access that both contain student data. Both tables may contain records on the same student. I want to merge those records in a report. There is nothing in either table that uniquely identifies each student except perhaps the DOB, but a student w/diff name could also have this DOB. For example:Table 1Student Name Student DOB Some other info... smith, jane 01/01/97doe, todd 01/01/97smith, kim 03/07/92Table 2Student Name Student DOBsmith, jane a 01/01/97brown, joe 06/18/95I want to merge Jane Smith's record from both tables, but her name has a middle initial included in the 2nd table so I don't know how to write a statement to include her in my report! Help!!!Please tell me how to write a statement

Link to comment
Share on other sites

wow nice database :)No unique identifier! You should always have a unique id. The names should be in a separate field (first name, last name, middle name). I guess you could compare names and DOB.

Link to comment
Share on other sites

I know, I let access assign keys.
What? How long have you been using computers? Surely you can't still believe that Microsoft programs make good decisions for you! Yeah, you always want to have a unique ID on nearly every table, with a couple exceptions. Even for something like a user table where you might have a unique user ID or email address, still have the database keep track of an autonumber for each row. About the only place you wouldn't need a unique ID is for a table that relates two other tables, like this:table written_bybook_idauthor_id
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...