Toad World® Forums

Need help with sql query


#1

Hello,
I hope this is the right forum for questions on sql queries.

I have a table that holds course descriptions.
There are 3 columns, code Char(20), Section char(50) and Note (long).

Examples of Section values are “Course Description”, “Objectives”, “Target Audience” etc.
Different courses can have one or more sections, so one course may have just Course Description and Target Audience and another may have all three.
There are about 6 distinct sections.
The order of section rows (within a code) is not fixed.

I need a query that gives me all the notes (substr first 2000 only) in one result column and row for each code.

Essentially I want results to be CODE, NOTE where the notes includes all note sections prefixed by section type on prev line eg.

Code101, Course Description
This course will teach…

             Objectives
             - how to run sql
             ....

             Target Audience
             - All analysts
             ....

Code102, Course Description
This course will teach…

             Target Audience
             - All analysts

SD1616


#2

We have a message board forum that’s setup exactly for these types of questions: Toad users who need help with SQL.

Check this out:
http://tech.groups.yahoo.com/group/TOADSQL/