Skip to content
Advertisement

fetch records based on mysql alias using having clause

i am having bibles table where user read 3 bible chapters every day. My query works fine as from this answer . i have two columns in table id, chapter_name i.e below :-

and after that i used below query

Its giving me blow output :-

what i want when user requests for date 24 feb 2020 it must come 3 records. currenly its coming all records with actual read date. My expected output is like below:

I have tried below query but its giving me error:-

ERROR IS

Can anyone help me to resolve this issue?

Advertisement

Answer

You can use sub-query as below:

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement