Parent Table
----------------
Pid | PField1 | PField2 | PField3 | PField4
1 A Aa Aaa Aaaa
2 B Bb Bbb Bbbb
Child Table
----------------
CPid | CField1 | CField2 | CField3
1 X Xx Xxx
1 X1 X1x X1xx
1 X2 X2x X2xx
2 Y Yy Yyy
2 Y1 Y1y Y1yy
2 Y2 Y2y Y2yy
when we create a join between this 2 table the output will be as such
Output
---------
Pid | PField1 | PField2 | PField3 | PField4 | CPid | CField1 | CField2
| CField3
1 A Aa Aaa Aaaa 1
X Xx Xxx
1 A Aa Aaa Aaaa 1
X1 X1x X1xx
1 A Aa Aaa Aaaa 1
X2 X2x X2xx
2 B Bb Bbb Bbbb 2
Y Yy Yyy
2 B Bb Bbb Bbbb 2
Y1 Y1y Y1yy
2 B Bb Bbb Bbbb 2
Y2 Y2y Y2yy
I want the output through query as below
desired output
---------
Pid | PField1 | PField2 | PField3 | PField4 | CPid | CField1 | CField2
| CField3
1 A Aa Aaa Aaaa 1
X Xx Xxx
1 X1 X1x X1xx
1 X2 X2x X2xx
2 B Bb Bbb Bbbb 2
Y Yy Yyy
2 Y1 Y1y Y1yy
2 Y2 Y2y Y2yy
Is it possible to write query to get such output..
The text wrapping made this difficult to read but it seems you want to
suppress repeating information, likely because you are displaying it
in a report. is this correct?
If so, this would best be handled in the reporting tool.
Thanks
Carl
Is it possible for such query or not plz let me know?
Crystal Reports will allow you to suppress repeating information and
personally I feel that is the way you should go. There was a thread on
this a little while back that may help you:
You can suppress this information in your stored procedure but its a
pain to do and I believe not worth the effort. A report writer is best
used as a formatting tool and this definitely falls under the
formatting category.
Hope this helps
Carl
I would like to say that I have never worked with Crystal, but that is
not really true. But almost. There is one thing I know though: they
have forums where you can ask questions.
--
Erland Sommarskog, SQL Server MVP, esq...@sommarskog.se
Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx