You are on page 1of 2

SELECT count(*) AS `count` FROM (

SELECT t.id
topic_id,
t.title
topic_title,
t.slug
topic_slug,
s.id
subject_id,
s.title
subject_title,
s.slug
subject_slug,
c.id
course_id,
c.title
course_title,
c.slug
course_slug,
b.id
book_id,
b.title
book_title,
b.aliased_title
book_aliased_title,
b.edition
book_edition,
b.isbn
book_isbn,
b.language
book_language,
b.author
book_author,
TRIM(CONCAT(b.title, (CASE
WHEN b.edition = 0 THEN ''
WHEN b.edition % 10 = 1 THEN CONCAT(' ',
b.edition, 'st')
WHEN b.edition % 10 = 2 THEN CONCAT(' ',
b.edition, 'nd')
WHEN b.edition % 10 = 3
THEN CONCAT(' ', b.edition, 'rd')
ELSE CONCAT(' ', b.edition, 'th') END), ' by ',
b.author, ' ',
b.isbn))
book_complete_title,
cs.id
content_set_id,
cs.title
content_set_title,
cs.type
content_set_type,
cs.slug
content_set_slug,
cs.questions_count
content_set_questions_count,
cs.quizzes_count
content_set_chapters_count,
cs.explanations_count
content_set_explanations_count,
cs.origin
content_set_origin,
ch.id
chapter_id,
ch.title

You might also like