Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Best Method to Search Two Tables
Message
 
 
À
10/04/2003 11:28:01
N. Lea
Nic Cross Enterprises
Valencia, Californie, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00776111
Message ID:
00776127
Vues:
13
>The first process that I attempted is not going to work because of the number of crazy sequences to process. So I was wondering if there was a optimized method to search additional two tables from a table with a sequence of invoice numbers.
>
>I have a tableA with various amounts of invoices. I need to search a current table (tableB) and an archive table (tableC) for any of the invoices listed in tableA. Essentially, the system will search for the invoice in tableB first, but if it is not found it will search tableC. Either way, when the invoice is found from either tableB or tableC, the information will be place into a cursor.
>
>I attempted a SQL, but it froze halfway through...here is my code:
>
>
>select * from invoice_temp ;
>left outer join current_items.inv_no on inv_no ;
>left outer join archive_items_old.inv_no on inv_no ;
>into cursor sql_test
>
Try
SELECT * FROM current_items ;
   WHERE inv_no IN ( ;
     SELECT inv_no FROM invoice_temp) ;
UNION ;
SELECT * FROM archive_items ;
   WHERE inv_no IN ( ;
     SELECT inv_no FROM invoice_temp) ;
INTO CURSOR whatever
* Or 
SELECT * FROM invoice_temp ;
   WHERE inv_no IN ( ;
     SELECT inv_no FROM current_items) ;
     OR inv_no IN ( ;
     SELECT inv_no FROM archive_items) ;
whichever suits you.
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform