Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to filter the records
Message
De
25/02/2007 13:53:36
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Divers
Thread ID:
01198651
Message ID:
01198656
Vues:
6
>I am inserting the records with this sql
>
>select * from Student where Admtd = 1 ;
> into cursor curNewStudents nofilter
>
>if _tally > 0    insert into dlyatten (code, date, type, category, scode, lCode, sec ) ;
>   select code, m.pDate, 1, "P", scode, lCode, Sec   from curNewStudents
>endif
>My problem is this,i have already some records in dlyatten.category, When i use above sql its insert all new records.

You can use a sub-query, such as
INSERT INTO ... ;
  SELECT ... ;
    WHERE < Student Primary Key > NOT IN ;
      ( SELECT < Student Primary Key > FROM DlyAtten )
You can actually put all your code into one INSERT - SQL:
INSERT INTO ... ;
  SELECT ... FROM Student ;
    WHERE < Student Primary Key > NOT IN ;
      ( SELECT < Student Primary Key > FROM DlyAtten ) ;
    AND Student.Admtd = 1
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform