MySQL Forums
Forum List  »  Newbie

Select Query based on closed / reopened flag
Posted by: Ram Kumar
Date: July 13, 2015 02:26AM

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

Options: ReplyQuote


Subject
Written By
Posted
Select Query based on closed / reopened flag
July 13, 2015 02:26AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.