thank you for the replies thus far... both were helpful in allowing me to better understand the logic behind the issue (the simplicity of rudy's where statement with the functionality of mike's select union). however, i'm still confused as to how the specific date information should be stored.
to re-use the linked example:
Code:
@start @end
| |
1 FR---TO | |
| |
2 FR-|-TO |
| |
3 | FR---TO |
| |
4 FR-|---------|-TO
| |
5 | FR-|-TO
| |
6 | | FR---TO
each numbered line item can be adapted to represent an item in the equipment table. the 'fr' and 'to' reflect a date range reserved for an existing project. the @start and @end are date values for a new project (result: items 1 and 6 will be available for reservation by the new project).
new question
what's the best way to organize my data?
in my original example, do the dates stored in the projects table result in a many to many relationship with the equipment table -- each project may have multiple items and each item may have multiple projects?
if so, say i split the 2 date columns (fr and to) into a new table (for 2 one to many relationships with projects and equipment), how do @start and @end (the inputs for a new project) fit into the picture?
***edit***
to answer questions...
most projects are remote, requiring the equipment to be on-site for the duration. there are instances where spares will be taken, which will be the only requirement that may incur some sort of financial penalty. the database has point of contact information for each project that was omitted for post brevity. i also did not include db, table, and column specifics for this reason.