Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can Count(), CASE(), and Distrinct be combined?
Message
From
28/01/2019 16:55:39
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01665760
Message ID:
01665776
Views:
50
>Hi,
>
>I am trying to count unique values in the field (using SQL Select) if the value is greater than 0
>
>So, here is syntax I use (simplified) (which generates an error):
>
>select count( case when mytable.myfield = 0 then 0 else distinct( mytable.myfield ) end ) as TotCount
>
>
>What is wrong in the above syntax?
>
>TIA
select count( distinct  mytable.myfield ) as TotCount from myTable where mytable.myfield <> 0
Ç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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform