lundi 30 mars 2015

Select last value and totalcount from joined table


Vote count:

0




I made two tables in my database;


Now,


The todo_list table contains


But has childs called list items, hence the 2nd table;


This table todo_list_item contains



  • id

  • list_id

  • name

  • status_id


What i'm trying to achieve, is:



  1. Listing all todo_lists

  2. Show how many todo_list_items they contain

  3. Get the last status_id from the todo_list_item table, per todo_list


Can i achieve this with one join, or do i really have to join the todo_list_item table twice, to get the count of items, and the last status_id seperately?



asked 16 secs ago

BBQ.

161






Select last value and totalcount from joined table

Aucun commentaire:

Enregistrer un commentaire