I will analyze this post in three sections to be as clear as possible. The first is the information you need to know. Secondly, these are the decisions that I have tried to make so far. In the third section there will be questions. I should also clarify that this is the first time I'm using CrystalReports.
Information
I am currently working with Visual Studio 2010 with C # and I am using SAP Crystal reports. I am showing data using a MySQL database.
Now here are the tables that I use to display the report:
Table : orders
Fields : id(primaryKey), date(DATE), quantity(INT), fksizes(INT), fkclients(INT)
Table : sizes
Fields : id(primaryKey), name(VARCHAR(30)), price(FLOAT)
Relationship between these 2 tables : orders.fksizes with sizes.id
Basically, I pass a range of dates as Crystal Reports parameters to display information only between these dates. Then I created 2 parameters: StartDateand EndDateboth types Date.
What i tried
, , , :
SELECT sizes.name, SUM(orders.quantity) AS totalQty,
(SUM(sizes.price) * orders.quantity) AS totalPrice,
orders.date
FROM orders
INNER JOIN sizes ON orders.fksizes = sizes.id
GROUP BY sizes.name, orders.date
. "", totalQty sumTotalQty. totalPrice sumTotalPrice.
2 , :
Size name Quantity sold Total Price
------------------------------------------------------------------------------
Big 2 $6.00
XBig 7 $28.00
sumTotalQty 9 sumTotalPrice $34.00, . , 2013-10-29 orders.date, 2013-10-30.
, . , 2013-10-30 , sumTotalQty, 7 sumTotalPrice, $28.00. , sumTotalQty 9 sumTotalPrice $34.00, .
WHERE sql-, , ( → ...):
SELECT sizes.name, SUM(orders.quantity) AS totalQty,
(SUM(sizes.price) * orders.quantity) AS totalPrice, orders.date
FROM orders
INNER JOIN sizes ON orders.fksizes = sizes.id
WHERE orders.date BETWEEN '{?StartDate}' AND '{?EndDate}'
GROUP BY sizes.name, orders.date
. , , {?StartDate} {?EndDate} , . WHERE orders.date BETWEEN @StartDate AND @EndDate.
{?StartDate} {?EndDate} , , ?- ( WHERE), ? , .
2 :
, .