I have two fields in table, (i) section_from & (ii) section_to, both fields has Date datatype, these fields tells us that this law section is enforced From(section_from) this date To(section_to) this date. The problem is, the latest law sections (active law) which are issued by the government has no specific To(section_to) date, Means we don't know what is the life of this law section maybe it is never changed from start to up-to-day or maybe government thinks after two months that this law section should be omitted or changed.

Question:
Is there anyway that, i mark the rows by ( Boolean attribute ) and tell the database that which rows have 1 value, update the section_to date with current date ?

Recommended Answers

All 3 Replies

Why not leave the "section_to" value NULL (meaning no value). In your queries, you can then use IFNULL(section_to, NOW()). Once you know the correct end date, you can always fill it correctly.

what if the the user enter the date and ask for show the law section of that date ? How can i compare date in query with Null ?
Eaxample
where section_from => Date AND section_to <= Date

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.