I
If
Good evening,
I have the SQL Query below which gives me a total + Percentage result for
all my records.
The Name of my Table is "Datas".
I have two fields : "Customers" and "'Type".
This SQL query gives me a total result for all the customers.
Query Result :
Total Type1 Type2 % Type 1 % Type 2
100 15 85 15% 85%
I would like to obtain a total by customer.
Query Result :
Customer Total Type1 Type2 % Type 1 % Type 2
1 10 1 9 10% 90%
2 8 6 2 75% 25%
3 5 2 3 40% 60%
.....
The value in the Type field can be different, 1111111100 or 11551111100 for
example.
Thanks for your help.
--------------------------------------------------------------------------------
SELECT
DCount("[Type]","Datas") AS Total,
DCount("[Type]","Datas","[Type] like '*100*'") AS [Type 1],
DCount("[Type]","Datas","[Type] like '*300*'") AS [Type 2],
Format(DCount("[Type]","Datas","[Type] like
'*100*'")/DCount("[Type]","Datas"),"Percent") AS [% Type 1],
Format(DCount("[Type]","Datas","[Type] like
'*300*'")/DCount("[Type]","Datas"),"Percent") AS [% Type 2],
FROM Datas
GROUP BY
DCount("[Type]","Datas"),
DCount("[Type]","Datas","[Type] like '*100*'"),
DCount("[Type]","Datas","[Type] like '*300*'"),
Format(DCount("[Type]","Datas","[Type] like
'*100*'")/DCount("[Type]","Datas"),"Percent"),
Format(DCount("[Type]","Datas","[Type] like
'*300*'")/DCount("[Type]","Datas"),"Percent");
--------------------------------------------------------------------------------
I have the SQL Query below which gives me a total + Percentage result for
all my records.
The Name of my Table is "Datas".
I have two fields : "Customers" and "'Type".
This SQL query gives me a total result for all the customers.
Query Result :
Total Type1 Type2 % Type 1 % Type 2
100 15 85 15% 85%
I would like to obtain a total by customer.
Query Result :
Customer Total Type1 Type2 % Type 1 % Type 2
1 10 1 9 10% 90%
2 8 6 2 75% 25%
3 5 2 3 40% 60%
.....
The value in the Type field can be different, 1111111100 or 11551111100 for
example.
Thanks for your help.
--------------------------------------------------------------------------------
SELECT
DCount("[Type]","Datas") AS Total,
DCount("[Type]","Datas","[Type] like '*100*'") AS [Type 1],
DCount("[Type]","Datas","[Type] like '*300*'") AS [Type 2],
Format(DCount("[Type]","Datas","[Type] like
'*100*'")/DCount("[Type]","Datas"),"Percent") AS [% Type 1],
Format(DCount("[Type]","Datas","[Type] like
'*300*'")/DCount("[Type]","Datas"),"Percent") AS [% Type 2],
FROM Datas
GROUP BY
DCount("[Type]","Datas"),
DCount("[Type]","Datas","[Type] like '*100*'"),
DCount("[Type]","Datas","[Type] like '*300*'"),
Format(DCount("[Type]","Datas","[Type] like
'*100*'")/DCount("[Type]","Datas"),"Percent"),
Format(DCount("[Type]","Datas","[Type] like
'*300*'")/DCount("[Type]","Datas"),"Percent");
--------------------------------------------------------------------------------