Quantcast
Channel: SQL Server Reporting Services, Power View forum
Viewing all articles
Browse latest Browse all 10045

Printing X number of labes pr line

$
0
0

Hi

Can someone help me out on a query to be used in reporting service. I need to print X number of labels for each returned result in a SQL statement.

I have a SQL statemement that has the following result

[School], [Address], [NumberOfLabels]

First, Street1, 1
Second, Street2, 3
Third, Street3, 5

The [NumberOfLabels] is from a lot of different parameters.


What I need is

[School], [Address]

First, Street1
Second, Street2
Second, Street2
Second, Street2
Third, Street3
Third, Street3
Third, Street3
Third, Street3
Third, Street3

Now since the statement should be used for reporting service, and the database is locked ( MSCRM Onpremise ) for creating procedures or tables i need it all in just one complete statement

I was thinking something along the following, but I can't get it to work. I know the last part of the statement is completely wrong, but I want to show my idea. 

SELECT [School], [Address], Count([School]) + 1 AS [NumberOfLabels] from [Mytable] Group By [School]
CROSS JOIN (SELECT TOP(Count([School]) + 1 AS [NumberOfLabels] from [Mytable] Group By [School] WHERE [MyTable].[School] = [NewTable].[School]) as [NewTable]

Thank you in advance

Morten Kessel


Viewing all articles
Browse latest Browse all 10045

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>