?
Solved

distinctcount in sql?

Posted on 2011-10-18
2
Medium Priority
?
279 Views
Last Modified: 2012-06-21
Here is code from the formula workshop in crystal reports:
if DistinctCount ({I_Ticket.Seat}, {Exchange_Table2.Listing_ID}) <> {Exchange_Table2.Qty} then "N"
else "Y"
I would like to be able to do this in sql server so that I can use this information to correct the value in exchange table 2.   So I guess the main question is:  How do I do distinctcount in sql server
0
Comment
Question by:vrosas_03
1 Comment
 
LVL 23

Accepted Solution

by:
Rajkumar Gs earned 2000 total points
ID: 36990883
This is one example
SELECT COUNT(DISTINCT USER_ID) FROM USERS

Open in new window

0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Suggested Courses

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question