[dba-SQLServer] (cross posted) Looking for some Crystal Reports help

Stuart McLachlan stuart at lexacorp.com.pg
Wed Mar 24 16:45:58 CDT 2010


Classic situation for a "numbers table" or "dimension table".
Create a table called tblNumbers containing a single PK field. Populate it with numbers from 
1 to whatever you may need.  Then include that table in your query

SELECT QyrLabels.Name, qryLabels,Adress,, tblNumbers.Number,
qryLabels.Cartons
FROM qryLables, tblNumbers
WHERE tblNumbers.Number<=[Cartons];
Order by Name,Number

will return something like

Name    Address    Number   Cartons
Joe      1 Main St      1                3
Joe      1 Main St      2                3
Joe      1 Main St      3                3
Fred     2 New St     1                 2
Fred     2 New St     2                 2

-- 
Stuart


> -----Original Message-----
> From: dba-sqlserver-bounces at databaseadvisors.com
> [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Jeff
> Barrows
> Sent: Wednesday, March 24, 2010 4:53 PM
> To: accessd; SQLServer; Tech List
> Subject: [dba-SQLServer] (cross posted) Looking for some Crystal Reports
> help
> 
> Has anyone done a crystal report for shipping labels where you know the
> total number of cartons, but do not have a record for each carton?
> 
> For example, I have 1 record telling me there will be 9 cartons.  I need to
> be able to loop through the records and print a label for each carton.
> 
> -- 
> Jeff Barrows
> MCP, MCAD, MCSD
> 
> Outbak Technologies, LLC
> Racine, WI
> _______________________________________________




More information about the dba-SQLServer mailing list