Information générale
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
>Hello,
>
>I could use some help here. What I am trying to do is take the records from 6 different tables and put all the records into one table. To do this I am going to have to add a few fields so I know which table the record comes from.
>
>Here is the code that I am using.
>
>use newmen.dbf
>go top
>scan
> INSERT INTO counttbl(Num,priority,last,first,sex,act,;
> act_length,act_date,status,trans_num,;
> trans_type,comments1,comments2,add_date,;
> prog_code,trans_stud,new_stud,ret_stud,;
> late_ret_stud,off_stud,temp_stud)
> VALUES (num,priority,last,first,'m',act,act_length,act_date,;
> status,trans_num,trans_type,comments1,comments2,;
> add_date,prog_code,tran_stud,'1','0','0','0','0')
>endscan
>
>The values need to come from the newmen table and go into the counttbl. There is no sex, new_stud, ret_stud, late_ret_stud, off_stud, or temp_stud so I am just putting flags in them to make it easy to run queries on.
>
>Is this even a good way to do this???
>
>I would appreciate any help that could be given.
>
>Thanks
>
>Brent Knight
>Residential Computing
If you are having problems with pulling fields with different names than the ones on the destination table you can use 'as NewDestinationName'and the field will have that name, in this case you don't have to insert constants previous to the required values.
If you don't need the functionality mentioned above I would do it in that exact way.
Regards
Oscar
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement