Matthew writes "I am currently using SQL Server 2000 SP4. Developing a website in Visual Studio 2005.I have created a database that has a JOBS table, each row of the table has corresponding records in a JOB_TASKS table. Each job may have a different number of records in the JOB_TASKS table.I am trying to create a query that returns a few fields of the JOBS table, then searches the JOBS_TASKS table for all related records and uses those records to create additional column names back in the query and fill in the data in the correct columns.So if the JOBS table fields & data look like this:JOB_ID, NAME, DATE5000 Bob 2006-01-215001 John 2006-01-22
And the JOBS_TASKS table fields & data look like this:JOB_TASK_ID, JOB_ID, TYPE, COMPLETED 1 5000 100 Yes 2 5000 200 No 3 5001 100 Yes 4 5001 200 No 5 5001 300 No
Then the query would output:JOB_ID, NAME, DATE, TASK_100, TASK_200, TASK_3005000 Bob 2006-01-21 Yes No5001 John 2006-01-22 Yes No No
Note the TASK_100, TASK_200 & TASK_300 fields above are to be created dynamically depending on the maximum related records in JOB_TASKS and labeled using the TYPE field value.The idea is to show all the jobs in a GridView and the progress of each job represented accross in columns.Can you help?Thanks Matthew"