As i wrote before: SQL is not for 'visualize' data!
That is not a system for presentation; that is a language for querying and manipulating data.
OriginalGriff wrote:SQL is not about presentation of the data, each row is intended to be self contained (...)
How many times we need to repeat it?
You need to read about JOIN
] statement. By using joins
], you can retrieve data from two or more tables based on logical relationships between the tables. For example:
SELECT c.Customer_CNIC, g.Guarantor_CNIC
FROM Customer c INNER JOIN Guaronters g ON g.Customer_CNIC=c.Customer_CNIC
ORDER BY c.Customer_CNIC
Tips (to achieve that what OriginalGriff wrote):
1) How to CREATE TABLE
]? - section Temporary tables
. There you'll find informations about: how to insert data into temporary table.
2) How to go through the collection of records? Use cursor
] and WHILE
] command - section: B. Using WHILE in a cursor