╔════╦═══════╦═══════╦═══════╗
║ id ║ Col A ║ Col B ║ Col C ║
╠════╬═══════╬═══════╬═══════╣
║ 1 ║ 36 ║ 50 ║ AAA ║
║ 2 ║ 36 ║ 50 ║ BBB ║
║ 3 ║ 36 ║ 44 ║ CCC ║
║ 4 ║ 36 ║ 44 ║ DDD ║
║ 5 ║ 56 ║ 33 ║ EEE ║
║ 6 ║ 56 ║ 78 ║ FFF ║
╚════╩═══════╩═══════╩═══════╝
How to use laravel query builder to get table rows where highest number in 'Col B' and in same value 'Col A'?
In the end, I hope to get the result like:
╔════╦═══════╦═══════╦═══════╗
║ id ║ Col A ║ Col B ║ Col C ║
╠════╬═══════╬═══════╬═══════╣
║ 1 ║ 36 ║ 50 ║ AAA ║
║ 2 ║ 36 ║ 50 ║ BBB ║
║ 6 ║ 56 ║ 78 ║ FFF ║
╚════╩═══════╩═══════╩═══════╝
the reason why getting these row is because in 'Col A' have two number 36 & 56. The highest number in 'Col B' is 50 for 36, and The highest number in 'Col B' is 78 for 56.