Select Query based on closed / reopened flag [message #639630] |
Mon, 13 July 2015 03:36 |
|
simramkumar
Messages: 2 Registered: July 2015
|
Junior Member |
|
|
0
down vote
favorite
I have a dimension and a transaction_fact tables. transaction_fact table has multiple records of a single record of the dimension table. transaction_fact table has columns closed_today_flag, reopened_today_flag, effective_from, effective_till along with other columns.
When a record is created in dimension table an entry will be added in transaction_fact table. If the same record is updated/closed/reopened entries will be added in the transaction_fact table.
Dimension table will not have any status. Currently the record in a dimension table may be in open/closed/reopened state.
Query:
I have to select only closed records from transaction_fact table based on the current status from start date(effective_from) to end date(effective_till).
Table Data:
closed_today_flag reopened_today_flag effective_from effective_till
true false 2014-05-29 09:30:00.000 2014-10-31 09:30:00.000
false false 2014-05-28 09:30:00.000 2014-05-29 09:30:00.000
false false 2015-01-22 10:30:00.000 2015-02-25 10:30:00.000
false false 2014-05-27 09:30:00.000 2014-05-28 09:30:00.000
false false 2015-02-25 10:30:00.000 2015-03-09 09:30:00.000
false false 2015-03-09 09:30:00.000 2015-03-09 09:30:00.000
false false 2015-03-09 09:30:00.000 2015-03-09 09:30:00.000
false true 2014-10-31 09:30:00.000 2015-01-22 10:30:00.000
false false 2015-03-09 09:30:00.000 2015-06-25 09:30:00.000
false false 2015-06-25 09:30:00.000 2200-01-01 10:29:59.999
|
|
|
|
|
|
|
|