Welcome Guest, Not a member yet? Register   Sign In
having issue with join only recent row

So i have been working with codeigniter for three years, and for database queries most of the time i use active records, and design database in a way that avoids complex queries .

But current project i am working on has recurring membership plans and i am saving them in a table with start and end date .


membership table

other table is 

name etc

now at the time of login i have to do a joing with table members and membership but joins needs to return only recent entry for that member from membership table.

I can do it by simple queries first get the member and then membership recent row for that member and then do the comparison, but there would be case where i would need to use pagination and in that case i will need a single query of join.

which can do following.


get member information from members table

whose (enddate+1 day) only for recent entry for that member from membership table is smaller than currentdate.

if the query can be done using active records that would be great help.

Any help would be greatly appreciated.

Thank You guys.

Theme © iAndrew 2016 - Forum software by © MyBB