I am sorry if my question was unclear but I need to use that DB:: raw. I am just not getting accurate result so I donot know whats wrong in my query.
Although thanks for your answer.It seem useful.
Just got confused because your post was under Eloquent category so I assumed that you wanted to resolve it, the Eloquent way hehe.
Regarding the query that you already tried, what you mean by "not getting result"?
You don't get anything at all? You get an error? You get an count that doesn't mach the expected on?
@marianomoreyra
No there is no error.
I am getting results but not getting the expected result.
Do you think my query is right or needs to be improved for better results?
Do you think this query will be for the long-term ??
&
Thank you so much for your time
@saurav77 at first glance that query looks like it should work (except for the "category" at the select, which I guess it should be "category_name" based on your tables description).
But if you think the results are not accurate, then you'll have to post more information in order to be able to help you.
For instance, and example with data, expected result and current result obtained might be helpful.
@marianomoreyra
Leave it for now. Now it's giving the expected result but I am worried when there will be more that 5000 data.I hope this query work in future.