0
私は、次のSQLがあります。SQL + Ion Auth + CodeIgniter?
SELECT (
(SELECT SUM(vote_score)
FROM question_votes
JOIN questions
ON vote_question = q_id
JOIN users
ON q_author = users.id
WHERE q_author` = users.id)
+
(SELECT SUM(vote_score)
FROM answer_votes
JOIN answers
ON vote_answer = a_id
JOIN users
ON a_author = users.id
WHERE a_author = users.id)) AS rep
を、私は(イオン認証の方法)、それはここで追加することにしたい。
$this->db->select(
array(
$this->tables['users'].'.*',
$this->tables['groups'].'.name AS '. $this->db->protect_identifiers('group'),
$this->tables['groups'].'.description AS '. $this->db->protect_identifiers('group_description'),
"(SELECT COUNT(`a_author`) FROM `answers` WHERE a_author = users.id) + (SELECT COUNT(`q_author`) FROM `questions` WHERE q_author = users.id) AS total_posts",
"SELECT
((SELECT SUM(vote_score)
FROM question_votes
JOIN questions
ON vote_question = q_id
JOIN users
ON q_author = users.id
WHERE q_author` = users.id)
+
(SELECT SUM(vote_score)
FROM answer_votes
JOIN answers
ON vote_answer = a_id
JOIN users
ON a_author = users.id
WHERE a_author = users.id)) AS rep"
)
);
私がfollowinエラーが出る:
うんは、数秒は質問を投稿した後、私は間違いを発見しました質問を登録しよう ON vote_question = q_id answer_votes FROM q_author = users.id WHERE q_author = users.id) + (SELECT SUM(vote_score) ONユーザー がvote_answer ON答え のJOIN、JOIN = a_id ユーザーに参加する ON a_author = users.id WHERE a_author = users.id))AS rep' –
時には私たちの頭が疲れて、 – Gerep