Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQLEXEC(Question)
Message
 
 
À
09/11/2001 19:53:51
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00579481
Message ID:
00580134
Vues:
24
This message has been marked as the solution to the initial question of the thread.
Hi Mike,

I still don't fully understand what are you doing. It would be helpfull also to know what backend you are using. Anyway, there is a solutions, I think, you're looking for:
=SQLEXEC(lnConn, ;
  "SELECT t1.engrcode, t1.dispatchno, SPACE(30) AS engrname " + ;
  "   FROM table1 t1 " + ;
  "   UNION ALL " + ;
  "SELECT t2.engrcode, t2.dispatchno, t2.engrname " + ;
  "   FROM table2 t2 " + ;
  "ORDER BY 1 "
I'm using SPACE() function as placeholder for engrname column, assuming that you are using VFP or MS SQL Server as backend. The lenght of placeholder should be the same as the lenght of the engrname column in the table2. BTW, you can use SELECT UNION in VFP instead of SCAN and INSERT in this situation too.

>Hi Sergey,
>
>what if suppose i have 2 tables: each containing records that are not related to the other. In native programming, i should scan the first table using engrcode as the param and insert it to a cursor then scan the second table for the param engrcode and insert the records to the same cursor. I don't know how to do this using SQLEXEC()
>
>
>table1(fields)
>>> engrcode
>>> dispatchno
>
>table2(fields)
>>> engrcode
>>> dispatchno
>>> engrname
>
>thanks again....
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform