Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL-SELECT: set a field value if addresses are the same
Message
De
15/04/2007 23:39:36
Aaron K. Y. Chu
Health & Care Co. Ltd.
Hong Kong, Hong Kong
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
SQL-SELECT: set a field value if addresses are the same
Divers
Thread ID:
01216101
Message ID:
01216101
Vues:
53
Dear All,


I would like to select the client records like so:

1. Name
2. Address_1
3. Address_2
4. Address_3
5. Address_4
6. same_address (if sameaddress -> 1; if not -> 0)

Previously, I used to do so, by 2 SQL statement
SELECT client_no,address1,address2,address3,address4, ;
ext_recall,0 as sameAddress FROM client_detail ;
WHERE next_recall = ?cYM ORDER BY 1 into cursor recall1

update recall1 set recall1.sameaddress="1" from recall1 ;
inner join ;
(Select address1,address2,address3,address4,Count(*) as nTimes ;
from recall1 group By address1,address2,address3,address4 ;
Having Count(*) > 1) b on recall1.address1=b.address1 ;
AND recall1.address2=b.address2 AND ;
recall1.address3=b.address3 AND ;
recall1.address4=b.address4
I wonder is there anyway to combine 2 steps into 1

Thanks in advance!
Best regards,

Aaron Chu

********************************************************

Working with Visual FoxPro is a lot of FUN!

********************************************************
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform