Discussion Locked

Complicated SQL Query

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hello,

I have to produce a report from a table that is extracted from a non-relational database system.

A sample of the table records would look like this:

file_no | ref_no | container_no
--------------------------------------
123456 |ref321 | cont777
--------------------------------------
123456 |ref456 | cont555
--------------------------------------
123456 |ref456 | cont333

I need to generate a single recordset that looks like this:

file_no | ref_no | container_no
--------------------------------------
123456 |ref321 | cont777
--------------------------------------
|ref456 | cont555
--------------------------------------
| | cont333

OR the data can be combined like this:

file_no | ref_no | container_no
--------------------------------------
123456 |ref321 | cont777
|ref456 | cont555
| | cont333

Any help would be greatly appreciated. Thanks!

5 replies

by bgibilaro

Sorry, the post mangled my diagram. Here is what the result should look like (just ignore the underscores:

I need to generate a single recordset that looks like this:

file_no | ref_no | container_no
--------------------------------------
123456__|ref321__|_cont777
--------------------------------------
________|ref456__|_cont555
--------------------------------------
________|________|_cont333

OR the data can be combined like this:

file_no | ref_no | container_no
--------------------------------------
123456__|ref321__|_cont777
________|ref456__|_cont555
________|________|_cont333
--------------------------------------

by amanabala

Hello,
I think this can be done. Before I can give you the exact answer, would you let me know
1. The database engine (to see if it supports SQL programming)
2. Programming language as the solution is language dependent.

Thanks
Ravi (ananth_manabala@yahoo.com)

by keung_chik

Your first recordset should be the answer that you need. If you want to print out that likes the last recordset, you should use the group feature of any report gernerator such as Crystal report or Quick report.

This discussion is closed to new replies.