Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select count(*) from,
Message
De
07/06/2002 05:25:49
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00665646
Message ID:
00665819
Vues:
18
>Can i use this query in visual foxpro to get the count.
>If the count is greater than one then there is a record with the same values and can show a message duplicate record found.
>
>
>lcSource = "SELECT count(*) from sub ;
>WHERE sub.project_no = projno ;
>AND sub.workpkg_no = workpkgno ;
>AND sub.sub_sec = subsec ;
>AND sub.sub_para = subpar ;
>AND sub.sub_seq = subseq ;
>AND DELETED() = .f. ;
>ORDER BY project_no, workpkg_no ;
>into cursor cSource"
>
>
>Thank you.

Rajender,
It sounds like what you want is :
set deleted on
SELECT prj.projno, prj.workpkgno, cnt(*) as DupeCnt ;
  from ProjParent prj ;
  inner join Sub ;
     on sub.project_no = prj.projno ;
       AND sub.workpkg_no = prj.workpkgno ;
       AND sub.sub_sec = prj.subsec ;
       AND sub.sub_para = prj.subpar ;
       AND sub.sub_seq = prj.subseq
  having DupeCnt > 1 ;
  group BY prj.projno, prj.workpkgno ;
  order BY prj.projno, prj.workpkgno ;
into cursor cSource
I think projno, workpgno etc were fields from current alias which I assumed to be the parent table. Yours would work with slight modification. However since I feel you would do this in a loop for each projno, workpkgno of parent, doing it once outside loop would be much more effective.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform