SQL query to count number of distinct products

0 votes
how many customers ordered a distinct products and sort by count of distinct products?
Jun 10 in Tableau by preethi
34 views

1 answer to this question.

0 votes
Hi Preethi,

Use below SQL query,

SELECT CUST_ID, COUNT(DISTINCT PROD_ID) FROM ORDERS GROUP BY CUST_ID ORDER BY COUNT(DISTINCT PROD_ID);
answered Jun 10 by anonymous
• 25,900 points

Related Questions In Tableau

0 votes
1 answer

How to use LOD to count distinct number of records based on some condition?

From the desired output it seems that ...READ MORE

answered Apr 9, 2018 in Tableau by xyz
• 1,550 points
4,400 views
0 votes
1 answer

how to get the count of non zero values in a row

In first part you should solve the ...READ MORE

answered Apr 4, 2018 in Tableau by Atul
• 10,240 points
139 views
0 votes
1 answer

How to count occurrence of value and percentage of a subset in tableau public?

Although it sounds like a fairly easy ...READ MORE

answered Jun 5, 2018 in Tableau by Atul
• 10,240 points
2,844 views
+1 vote
1 answer

How to calculate the number of hours worked in Tableau?

Try using this LOD expression {fixed user : ...READ MORE

answered Aug 3, 2018 in Tableau by Atul
• 5,530 points
73 views
0 votes
1 answer

How to access MYSQL Database from tableau?

Hi Sindhu,  1. Double click on Mysql on the ...READ MORE

answered Mar 19 in Tableau by Cherukuri
• 25,900 points
57 views
0 votes
1 answer

Want a command to be executed in Salt only if a directory is empty

You should consider using this inside your ...READ MORE

answered Jun 12, 2018 in DevOps Tools by Damon Salvatore
• 5,510 points
38 views
0 votes
1 answer

Creating A New MySQL User In Amazon RDS Environment

AWS RDS security groups documentation (a common ...READ MORE

answered Jul 18, 2018 in AWS by Priyaj
• 56,520 points
149 views
0 votes
1 answer

How to aggregate and count the occurrence of TRUE and FALSE?

Hi, you can do any of below ...READ MORE

answered Mar 12 in Tableau by Cherukuri
• 25,900 points
88 views
0 votes
1 answer

How to get only the last n months action of all my records?

Hi Nithin, You can use Calculated field to ...READ MORE

answered Mar 8 in Tableau by Cherukuri
• 25,900 points
51 views