私はPHPとMySQLを使用していますが、私はいくつかの非現実的な結果を得ています。ところで関与のテーブルがあるMySqlクエリーで月ごとのブックごとの平均チャプター数を返します
BOOKS
id, book_title, isbn, publisher, price, l1_subject_id, l2_subject_id,
description1, description2, description3, call_date, chapter_proposal_date,
notification_acceptance_date, publishing_fee_date, final_manuscript_date,
1st_proof_reading, 2nd_proof_reading, book_schedule_date, active, url,
pages_num, edited_by, downloaded_num, file_size, unix_name, voted,
general_notes, BMcomment, description4, about_the_book, call_started,
kw_mandatory, kw_other, ignore_small, show_contributing_authors
BOOKS_CHAPTERS
id, users_id, books_id, order, books_sections_id, manuscript_title, price,
active, paypending, notice, created_at, last_modified, keywords, status,
book_editor_comments, hard_copy, invoiceing_data, extended_deadline,
next_deadline, technical_notice, number
SELECT
COUNT(b.book_title) as `Total number of books `,
COUNT(bc.manuscript_title) as ` Total number of chapters`,
#DATE_FORMAT(b.call_started, '%M %Y') as `Date`,
#DATE_FORMAT(b.call_started, '%Y-%m') as `Original date format`,
(COUNT(b.book_title)/COUNT(bc.manuscript_title)) as `Average chapter number by book per
month`,
b.id as book_id
FROM books b
JOIN books_chapters bc ON (b.id = bc.books_id)
WHERE b.call_started IS NOT NULL AND b.call_started != '0000-00-00'
#GROUP BY MONTH(b.call_started), YEAR(b.call_started),b.id
#ORDER BY YEAR(b.call_started) ASC, MONTH(b.call_started)ASC
あなたはどのような非現実的な結果を得ていますか? – Ehtesham
あなたは何を得ていますか?あなたが欲しいもの ? – Rikesh
ここで*正確に*問題がありますか? –