add join to images
This commit is contained in:
parent
22585b92fe
commit
ef547e9825
2 changed files with 2 additions and 0 deletions
|
|
@ -76,6 +76,7 @@ const getAllTags = (db: Db): Tag[] => {
|
|||
const query = `
|
||||
select c.id, c.slug, c.title, count(*) as total from categories c
|
||||
inner join image_x_category ixc on c.id = ixc.category_id
|
||||
inner join images i on i.id = ixc.image_id
|
||||
group by c.id order by total desc;`
|
||||
return db._getMany(query).map(row => ({
|
||||
id: parseInt(row.id, 10) || 0,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue