I want to ignore the duplicates in my database when I will set my “LIMIT 0, 50”, then “LIMIT 50, 50” then LIMIT….. I will need to scan the duplicates on only 1 column of my table, not all the columns at once. I can’t merge the duplicates because they are different in a way : these duplicates have different prices.
more precisely, I will need to show a list of these items, but to show their different prices at their right.
I need a precise number (50) per pages, so I cant load less then go to the next page. I could therefore load more from the beginning (changing the max and previous offsets if i’m on a far page) in a way that if i ignore the duplicates, I will got exactly 50 per pages and I will get the good number of pages shown at the end.
I’m a bit beginner with PHP and I have no idea about how to do that. Maybe pre-scan all the table and then start writing my code, by being flexible with my scan’s variables of LIMIT and everything ? what functions I need ? how ?
Else, do something pre-programmed or a function of php that I don’t know it exists can solve this problem ? Or I really need to get an headhache xD
I am not entirely certain of what you are asking, but I think you might want to do a aggregate statement along these lines:
This will bring back a list of 50 items and a second column where all the prices are grouped together. Then in your PHP code, you can either
explode()that second column keep it as is.Edit: If you select every field, you can’t then use an aggregate function. If you want to select other columns that won’t be different, add them to both the select and the group by sections like this: