Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6620343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:05:11+00:00 2026-05-25T21:05:11+00:00

I would appreciate your help greatly,I’m using php and mysql and I’m getting some

  • 0

I would appreciate your help greatly,I’m using php and mysql and I’m getting some unrealistic results, can you check my code if it is alright…btw the tables involved are

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
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T21:05:12+00:00Added an answer on May 25, 2026 at 9:05 pm

    You join on chapters, but you count on book titles.
    That means that you count the title for each chapter in the total number of books (or per month, if you re-add the group by).

    Use count(distict b.book_title), or rather count(distinct b.id) or count(distinct b.isbn) to get the number of distinct books in this result set.

    Same goes for chapters, and there you should also use id, which is probably unique, auto-numbered. Chapter titles may be the same between books.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to regular expressions and would appreciate your help. I'm trying to put
I would appreciate some help with something I working on and have not done
I would appreciate some help with an UPDATE statement. I want to update tblOrderHead
Hey there. I would really appreciate your help in creating a query that would
First, Thanks for your help - I greatly appreciate it. The core solution I
UPDATE: this has just started happening again, would appreciate any help. I am using
Your help would be greatly appreciated I have the following code: It is suppose
I have an interesting problem and would appreciate your thoughts for the best solution.
What, in your opinion (although I would highly appreciate articles / books on related
I would appreciate some guidance on modelling services and operations in WCF. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.