Note that there are some explanatory texts on larger screens.

plurals
  1. POCross Tab - Storing different dates (Meeting1, Meeting2, Meeting 3 etc) in the same column
    primarykey
    data
    text
    <p>I need to keep track of different dates (dynamic). So for a specific Task you could have X number of dates to track (for example DDR1 meeting date, DDR2 meeting date, Due Date, etc).</p> <p>My strategy was to create one table (DateTypeID, DateDescription) which would store the description of each date. Then I could create the main table (ID, TaskDescription, DateTypeID). So all the dates would be in one column and you could tell what that date represents by looking at the TypeID. The problem is displaying it in a grid. I know I should use a cross tab query, but i cannot get it to work. For example, I use a Case statement in SQL Server 2000 to pivot the table over so that each column name is the name of the date type. IF we have the following tables:</p> <p><strong>DateType Table</strong></p> <h2>DateTypeID | DateDescription</h2> <pre><code> 1 | DDR1 2 | DDR2 3 | DueDate </code></pre> <p><br> <strong>Tasks Table</strong></p> <h2>ID | TaskDescription</h2> <pre><code>1 | Create Design 2 | Submit Paperwork </code></pre> <p><br> <strong>Tasks_DateType Table</strong></p> <h2>TasksID | DateTypeID | Date</h2> <pre><code>1 | 1 | 09/09/2009 1 | 2 | 10/10/2009 2 | 1 | 11/11/2009 2 | 3 | 12/12/2009 </code></pre> <p><br> THE RESULT SHOULD BE:</p> <h2>TaskDescription | DDr1 | DDR2 | DueDate</h2> <pre><code>Create Design |09/09/2009 | 10/10/2009 | null Submit Paperwork |11/11/2009 | null | 12/12/2009 </code></pre> <p>IF anyone has any idea how I can go about researching this, I appreciate it. The reason I do this instead of making a column for each date, has to do with the ability to let the user in the future add as many dates as they want without having to manually add columns to the table and editing html code. This also allows simple code for comparing dates or show upcoming tasks by their type (ex. 'Create design's DDR1 date is coming up' ) If anyone can point me in the right direction, I appreciate it.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload