Record Count Crystal Reports 2008

20 pts.
Tags:
Crystal Reports
Crystal Reports 2008
I currently have a report where data pulls from a table labeled clients for things such as patient name, address, etc.  However, I would also like to get a count of orders that the client has made.  These orders are stored in a separate table and not counted, but linked by a client id number.  My question is how could i get a count of the number of order rows in a separate table for each client.

Software/Hardware used:
Crystal Reports 2008, SQL Server 2005

Answer Wiki

Thanks. We'll let you know when a new response is added.

Lets say you have these 2 tables:

CLIENT table with the columns ID, NAME, etc
and
CLIENT_ORDERS table with ID, ORD_ID, etc

You want CLIENT.NAME, count of orders.

something like this should work:
SELECT C.NAME , COUNT(CO.ORD_ID)
FROM CLIENT C , CLIENT_ORDERS CO
WHERE C.ID = CO.ID
GROUP BY C.NAME;

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • carlosdl
    I would prefer this syntax:
    SELECT c.name, COUNT(co.ord_id)
    FROM client c 
    JOIN client_orders co
    ON c.id = co.id
    GROUP BY c.name; 
    69,225 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following