Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL-SELECT: set a field value if addresses are the same
Message
From
15/04/2007 23:39:36
Aaron K. Y. Chu
Health & Care Co. Ltd.
Hong Kong, Hong Kong
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
SQL-SELECT: set a field value if addresses are the same
Miscellaneous
Thread ID:
01216101
Message ID:
01216101
Views:
55
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!

********************************************************
Next
Reply
Map
View

Click here to load this message in the networking platform