$posts = $sql->get("SELECT `id`, `name` FROM `posts` WHERE 1");
foreach ($posts as $post) {
echo $post->name;
$tags = $sql->get("SELECT `id`, `name` FROM `post_tags` WHERE `post_id` = $post->id");
foreach ($tags as $tag) {
echo $tag->name;
}
}