Welcome Guest, Not a member yet? Register   Sign In
mysql query question
#1

[eluser]keevitaja[/eluser]
hello,

i have 2 tables:

lists:
id
name

contacts:
id
list_id

where lists.id = contacts.list_id

i would like to pull all rows from lists with a count from contacts table as how many current list_id are in contacts table. would produce something like

2 doc 6

where 2 as lists.id, doc as lists.name and 6 as count(contacts.list_id)

how can i do it? can i do it also with active records?




Theme © iAndrew 2016 - Forum software by © MyBB