0

How to fetch the selected records shown as ticked , i need to select only records with distinct userid and their last entry records. the below query is fetching only the first 2 records

SELECT LOWER(applied.job_status), applied.* FROM `jh_job_posting` as `job` JOIN `jh_job_applied` as `applied` ON `applied`.`applied_job_id` = `job`.`job_id` WHERE `job`.`job_id` = '41' GROUP BY applied.user_id ORDER by applied.user_id DESC

enter image description here

ArtisticPhoenix
  • 21,464
  • 2
  • 24
  • 38
Anoop P S
  • 754
  • 1
  • 12
  • 31

1 Answers1

0

Yes finally i got it. but with a sub query

SELECT * from jh_job_applied WHERE aid IN( SELECT Max(aid)FROM `jh_job_applied` as applied where applied.applied_job_id=41 group by applied.user_id ORder by aid DESC)
Anoop P S
  • 754
  • 1
  • 12
  • 31