Compare two Table
-
Iv got 2 sql tables.. table1 - date, runNo, coop 20090101 C1234 B0018 20090211 C1234 B0150 20090228 C5678 BRT10 20090228 C5678 BP001 table2 - coop, runNo B0001 C1111 B0002 C2222 B0018 C1234 B0144 C5555 B0150 BRT10 BP001 C5678 BP110 C8888 I have to check in table1 for coop wif runNo wether the coop in table2 got that runNo and display the one that dont have runNo like the one in table1. Table1 is data that i extract from a file. all the list in that file means that coop have files for running number . so for table2 are the list of files in portal. so i must checked wether coop in portal got the rite file that is for table2, coop must have runNo .. if the coop in portal (table2) dont have that file(runNo) than i have to display the coop that dont have that runNo. I dont how to compare bcos its not comparing the 1st row in table1 to 1st row in table2. the flow is to search data in 1st row of table1 within table2..
-
Iv got 2 sql tables.. table1 - date, runNo, coop 20090101 C1234 B0018 20090211 C1234 B0150 20090228 C5678 BRT10 20090228 C5678 BP001 table2 - coop, runNo B0001 C1111 B0002 C2222 B0018 C1234 B0144 C5555 B0150 BRT10 BP001 C5678 BP110 C8888 I have to check in table1 for coop wif runNo wether the coop in table2 got that runNo and display the one that dont have runNo like the one in table1. Table1 is data that i extract from a file. all the list in that file means that coop have files for running number . so for table2 are the list of files in portal. so i must checked wether coop in portal got the rite file that is for table2, coop must have runNo .. if the coop in portal (table2) dont have that file(runNo) than i have to display the coop that dont have that runNo. I dont how to compare bcos its not comparing the 1st row in table1 to 1st row in table2. the flow is to search data in 1st row of table1 within table2..
Not sure I understood correctly, but it seems a simple SQL statement can do it, by joining (JOIN) both tables on their coop fields, then filtering (WHERE) on different runNo fields. :)
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
-
Not sure I understood correctly, but it seems a simple SQL statement can do it, by joining (JOIN) both tables on their coop fields, then filtering (WHERE) on different runNo fields. :)
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
-
thank u so much.. never think of join the tables.. do u have any link that explain on how to use JOIN? iv been trying to google it but most of the explanation r not clear.. tq :-D
-