Wesam
Jul 20th, 1999, 01:44 PM
Hi,
I have a problem in writing my query which extracts some records from a table which are (the records) not existing in another table.
E.g.: I have the following tables:
'Table1' with one field 'Index'
'Table2' with one field 'Index'
Table1.Index Table2.Index
------------ ------------
3 4
2 5
0 12
1 17
22 0
13 1
my question is how to write a query that compares all records in Table1.Index with all records in Table2.Index and extracts all those which are not matching each other. In above example the result should be:
3
2
22
13
.. my suggestion was:
SqlCommand='SELECT DISTINCTROW [Table1].Index
FROM [Table1] INNER JOIN [Table2] ON [Table1].Index <> [Table2].Index'
.. but it doesn't work, however, if change the criterion to select the opposite set it works fine !!
SqlCommand='SELECT DISTINCTROW [Table1].Index
FROM [Table1] INNER JOIN [Table2] ON [Table1].Index = [Table2].Index'
.. could you help me please
Any suggestions would be highly appreciated.
Wesam
------------------
I have a problem in writing my query which extracts some records from a table which are (the records) not existing in another table.
E.g.: I have the following tables:
'Table1' with one field 'Index'
'Table2' with one field 'Index'
Table1.Index Table2.Index
------------ ------------
3 4
2 5
0 12
1 17
22 0
13 1
my question is how to write a query that compares all records in Table1.Index with all records in Table2.Index and extracts all those which are not matching each other. In above example the result should be:
3
2
22
13
.. my suggestion was:
SqlCommand='SELECT DISTINCTROW [Table1].Index
FROM [Table1] INNER JOIN [Table2] ON [Table1].Index <> [Table2].Index'
.. but it doesn't work, however, if change the criterion to select the opposite set it works fine !!
SqlCommand='SELECT DISTINCTROW [Table1].Index
FROM [Table1] INNER JOIN [Table2] ON [Table1].Index = [Table2].Index'
.. could you help me please
Any suggestions would be highly appreciated.
Wesam
------------------