Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loop query needed??

Status
Not open for further replies.

gillianleec

Technical User
May 7, 2003
48
US
I have a table with the fields: ID, OrderID, Test0, Test1, Test2, Test2, ...Test40

I know this is not normalized but I don't have control over that part. What I need to do is build a report that is grouped by ID that displays each test (matched to another table by testname (Billrules) for the price of that test) in a separate line.

Example:

ID=090923890
CAB (this is the testname) $26.00
TEX $13.00

etc. for all the tests on a single record. Most records only have 3-4 test fields filled in. Here is a sample record: ID=090923890, OrderID=456456, Test0=CAB, Test1=TEX


I hope this is clear...
Gillian
 
To do this, you are going to have a MONSTER query that links each test field to another copy of the cost table. If you really can't get the data changed, I will try to help, but tell those who prevent you from changing that the db structure is truely bad.

ChaZ
 
I would really appreciate the help. This is a purchased program and it has all the functionality that they need in other areas. It is written in dbVista in Poland.

Is there any way we can write a loop for this. The field names are test1, test2, ... Maybe a test(n)and then a counter??

Gillian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top