struktura tych tabel:
download_cats:
- id,
- title,
- cat
download_files:
- id,
- title,
- cat
Próbowałem coś robić, ale pobiera mi dziwne wyniki ;/.
EDIT, zrobiłem coś takiego:
<?php $sql = 'SELECT c.id, c.title, COUNT(f.id) as records FROM ' . $this->table . '_files f LEFT JOIN ' . $this->table . "_cats c ON f.cat = c.id WHERE c.cat = $id GROUP BY c.title ORDER BY c.title"; ?>
wyświetla dobrze dane, ale nie pokazuje kategorii gdzie nie ma plików.