0

Hi i want to select the record with latest updated status using task_id as foreign key, I want this in Phpfox based query, but if can solve let me know the general query for this scnario

id     task_id   status
--------------------------
 1       2           1
 2       3           3
 3       2           3
 4       2           2  <------- select this record
 5       4           1
Mudassar Zahid
  • 305
  • 2
  • 14

1 Answers1

1

Is this what you want? task_id = 2 with last updated status(or I can say last inserted in table):

SELECT * FROM tbl_name WHERE task_id = 2 ORDER BY id DESC LIMIT 1
B. Desai
  • 16,414
  • 5
  • 26
  • 47