Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL query with proximity...
Message
 
To
01/08/2001 15:08:01
Simon La Rochelle
Consultant En E-Commerce
Granby, Quebec, Canada
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00538178
Message ID:
00538526
Views:
16
This message has been marked as the solution to the initial question of the thread.
I do not have the right syntax but the technique is the same as in VFP.
I try this:
 SELECT FirmID, FirmName, ShortPresentation,
        iif(ZipCode = 'J2G 9H8',6,
            iif( ZipCode = LEFT('J2G 9H8',5),5,
		iif(ZipCode = LEFT('J2G 9H8',4),4,
                    iif(ZipCode = LEFT('J2G 9H8',3),3,
                        iif(ZipCode = LEFT('J2G 9H8',2),2,
                            iif(ZipCode = LEFT('J2G 9H8',1),1,0)))))) as MyCode
   FROM Firms
     ORDER BY MyCode
Simon, When you have a new question start a new thread.
We can then find the thread in the search with the title.


>Do not seem to work in Access 2k...
>
>I did :
>
> SELECT FirmID, FirmName, ShortPresentation
> FROM Firms
> ORDER BY
> CASE
> WHEN ZipCode = 'J2G 9H8' THEN 6
> WHEN ZipCode = LEFT('J2G 9H8',5) THEN 5
> WHEN ZipCode = LEFT('J2G 9H8',4) THEN 4
> WHEN ZipCode = LEFT('J2G 9H8',3) THEN 3
> WHEN ZipCode = LEFT('J2G 9H8',2) THEN 2
> WHEN ZipCode = LEFT('J2G 9H8',1) THEN 1
> ELSE 0
> END
> DESC
>
>
>But I get a Syntax Error.
>
>Any idea ?
Previous
Reply
Map
View

Click here to load this message in the networking platform