I know that the subject is badly expressed, but hopefully I can get the
point across...
I'm a total newbie at MS Reporting services and I have a question. I
have a dataset something like this:
Customer Box Item Qty
A 1 X1 50
A 1 X2 50
A 2 X3 75
A 2 X4 25
A 3 X5 15
B 1 X1 35
B 1 X2 65
B 2 X2 10
B 2 X3 10
etc... you get the idea. Each box holds 100 mixed items; each customer
has one or more boxes.
The output report I want should look something like this:
Customer Box Contents
A 001 X1 50 * X2 50
002 X3 75 * X4 25
003 X5 15
Total for customer A: 3 boxes, 215 pieces
B 001 X1 35 * X2 65
002 X2 10 * X3 10 * X4 20 * X5 10 * X6
5
X7 5 * X8 40
003 X9 50
Total for customer B: 3 boxes, 250 pieces
I set it up as a report with two grouping levels. The tricky part is
the "contents" column. I want it to be a textbox that can be up to a
certain width, wrapping if necessary, and containing a string of data
from records. Any way to do that with Reporting Svcs?
If it helps, when I did this with MS Access, I made the wrapping
textbox part as a subreport with columns. I can try that with RS but
it seems like it might be possible another way?
I should also mention that I'm using SQL Server 2000, VB.NET 2003 as my
designer, so perhaps I don't have access to the newest features of 2005.I wrote:
> The tricky part is
> the "contents" column. I want it to be a textbox that can be up to a
> certain width, wrapping if necessary, and containing a string of data
> from records. Any way to do that with Reporting Svcs?
Never mind; I found this blog entry
http://blogs.msdn.com/chrishays/archive/2004/07/23/HorizontalTables.aspx
that gives a quite serviceable method for getting what I want.
Showing posts with label subject. Show all posts
Showing posts with label subject. Show all posts
Monday, March 26, 2012
Monday, February 20, 2012
Multiple results from single column
Ok this subject sounds a bit vague, but here's my question:
I have a table containing a user id column, a column with events (like log in) and a date column (mm/dd/yy hh/mm/ss).
What i would like to do is to count the number of users who have logged into my system, sorted by month.
Example: January - 20 users
Februari - 42 users
March - 13 users etc.
Can this be done with just one SQL statement? If so, can anyone give me an example query?
Thanks!
SanderHello,
what do you think about
SELECT TO_CHAR(date_field, 'MONTH'), count(*) FROM table_name
GROUP BY TO_CHAR(date_field, 'MONTH')
if you are using an Oracle database.
Hope this helps ?
Greetings
Manfred Peter
(Alligator Company)
http://www.alligatorsql.com|||Hi Manfred Peter,
I'm sorry to say i don't have Oracle, i run MSSQL7. So the statement you provided won't work (i know for sure the to_char function won't work) :rolleyes:
What i have so far is:
select count(users) from table where ops='login' and date between dateA and dateB
This will return me one number from the given timeframe. I want to create a statement that will give me the number of logins over the time period of a year for each month, so 12 numbers. I can't just copy/paste the same statement 11 times...can I :confused:
Thanks!
Sander.|||Hello Sander,
of course you can, but this means 12 times parsing the sqlstatement and reqeusting the datas from the database.
There must be an equivalent to the TO_CHAR function in MSQL Server.
You just need the function that gives only the complete month of a date value (lets say this function is called MONTH(x));
Then the statement
SELECT MONTH(date_field), COUNT(*) from table
GROUP BY MONTH(date_field)
This is the better way ... in my opinion
Search the doku for such a command :)
Let me know if you have further problems.
Manfred Peter
(Alligator Company)
http://www.alligatorsql.com
I have a table containing a user id column, a column with events (like log in) and a date column (mm/dd/yy hh/mm/ss).
What i would like to do is to count the number of users who have logged into my system, sorted by month.
Example: January - 20 users
Februari - 42 users
March - 13 users etc.
Can this be done with just one SQL statement? If so, can anyone give me an example query?
Thanks!
SanderHello,
what do you think about
SELECT TO_CHAR(date_field, 'MONTH'), count(*) FROM table_name
GROUP BY TO_CHAR(date_field, 'MONTH')
if you are using an Oracle database.
Hope this helps ?
Greetings
Manfred Peter
(Alligator Company)
http://www.alligatorsql.com|||Hi Manfred Peter,
I'm sorry to say i don't have Oracle, i run MSSQL7. So the statement you provided won't work (i know for sure the to_char function won't work) :rolleyes:
What i have so far is:
select count(users) from table where ops='login' and date between dateA and dateB
This will return me one number from the given timeframe. I want to create a statement that will give me the number of logins over the time period of a year for each month, so 12 numbers. I can't just copy/paste the same statement 11 times...can I :confused:
Thanks!
Sander.|||Hello Sander,
of course you can, but this means 12 times parsing the sqlstatement and reqeusting the datas from the database.
There must be an equivalent to the TO_CHAR function in MSQL Server.
You just need the function that gives only the complete month of a date value (lets say this function is called MONTH(x));
Then the statement
SELECT MONTH(date_field), COUNT(*) from table
GROUP BY MONTH(date_field)
This is the better way ... in my opinion
Search the doku for such a command :)
Let me know if you have further problems.
Manfred Peter
(Alligator Company)
http://www.alligatorsql.com
Subscribe to:
Posts (Atom)