April 27, 2008 at 10:58 pm
Dear All,
I have 2 table TableA with columns(FormId,Name,Desc)
TableB with Columns (FormId,ContainerType,MainFormId,Desc)
TableA
FormId Name Desc
1 A A
2 B B
TableB
FormId ContainerType MainFormId Desc
1 2SG 1 AA
2 4SG 1 AA
3 20R 1 AA
4 2SG 1 AA
5 20T 1 AA
6 40T 2 AA
7 40T 2 AA
8 4SG 2 AA
9 20R 2 AA
10 40T 2 AA
11 20T 2 AA
12 2SG 2 AA
i want the output like
1 A 2SG,2 20T,1 4SG,1 20R ,1 40T,1 A AA
2 b 2SG,1 20T,1 4SG,1 20R ,1 40T,3 A AA
Please help me to build a query for this
April 27, 2008 at 11:55 pm
Pls explain the question clearly
"Keep Trying"
April 28, 2008 at 12:16 am
The output you wanted is very cumbersome. Think of a matrix type output or Pivot table like output. 🙂
April 28, 2008 at 3:32 am
Actuall i have 3 table StuffTbl,ContainerTbl,ContainerTypeTbl,
StuffTbl contians FormId,CreatedBy,POD Columns.
ContainerTbl Contains FormId,ContainerTypeId(Ref key ContainerTypeTbl),StuffId(Ref key StuffTbl),Remarks
ContainerTypeTbl contains continerid,Type.
StuffTbl data
FormIdCreatedByPOD
1Rocky INT
2James RTW
ContinerTbl
FormIdContainerTypeIdStuffIDRemarks
11011
21021
31071
41181
51012
61022
71062
81122
91182
10 117 2
ContainerTypeTbl
ContainerIdType
10120R
1022FR
1032HG
1042HT
10520T
1062SG
10740R
10845F
1094FR
1104HG
11140T
1124SG
113AIR
114BB
115FR2
116FR4
117ISO
118LCL
I want the Output in this formate
2CType means the in Type which starts with 2
4CType means the in Type which starts with 4
FormIdPOD2CType4CTypeLCLAIRBBFR2FR4ISORemarks
1 INT 2 1 1 0 0 0 0 0
2 RTW 3 1 1 0 0 0 0 1
April 28, 2008 at 6:13 am
Check topic "Cross-Tab Reports" in BOL.
It describes how to build queries exactly like yours.
Good examples included.
_____________
Code for TallyGenerator
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply