|
EugeneLim11
Posting Yak Master
167 Posts |
Posted - 2009-04-06 : 02:23:45
|
| Hi, I have two identical tables (my administrative staff did not update the database using the ERP, and instead store the information in Excel, *sigh*) named StudentA, and StudentBThe columns are studentID (PK), studentName, Address. I would like a list of a studentID, studentName, AddressFromStudentA, AddressFromStudentB where the address from StudentA is different from studentB, and records of any students that are in StudentA, but not in Student B and vice versa. e.g.Assume I got the following information in StudentA tableStudentID , Student Name , Address S1 , Test Student 1 , ABC RoadS2 , Test Student 2 , DEF RoadS4 , Test Student 3 , GHI RoadIn studentB table, I got the following recordsStudentID , Student Name , Address S1 , Test Student 1 , ABC RoadS2 , Test Student 2 , XWZ RoadS3 , Test Student 4 , PLE RoadI would like to getStudentID , Student Name , AddressA, AddressBS2 , Test Student 2 , DEF Road, XWZ Road S3 , Test Student 4 , NULL, PLE RoadS4 , Test Student 3, GHI Road, NULL(s1 is not included since the addressA and address B are the same).How do I construct a query? When I use inner join, any null studentId in either table records are not included at the moment. :(E.g. Select A.StudentID, A.StudentName, A.Address as 'AddressA', B.Address as 'AddressB' from StudentA A, StudentB B where A.StudentID = B.StudentID and A.Address <> B.AddressWhat is wrong with my query? How do I ensure that any missing studentID will also be included? Any help is very much appreciated.Thank youEugenecheck out my blog at http://www.aquariumlore.blogspot.com |
|
|
EugeneLim11
Posting Yak Master
167 Posts |
Posted - 2009-04-06 : 02:41:09
|
| Heavymind, err... I am lost.. binary explainations makes me very fuzzy headed. I read the article twice, and I don't get it. Is there any simple method ?I am lost at the bottom -> I got 2 tables, so what is the sum(binaryID) I should select to get all differenceS?check out my blog at http://www.aquariumlore.blogspot.com |
 |
|