Question: For the attached query, i have written the below code. WITH BookCounts AS ( SELECT COUNT ( b . bookid ) AS Count, CONCAT (

For the attached query, i have written the below code.
WITH BookCounts AS (
SELECT
COUNT(b.bookid) AS Count,
CONCAT(a.firstname, '', a.lastname) AS AuthorName,
p.publishername AS PublisherName
FROM
Book b
JOIN
Author a ON b.author_id = a.authorid
JOIN
Publisher p ON b.publisherid = p.publisherid
GROUP BY
a.firstname, a.lastname, p.publishername
HAVING
COUNT(b.bookid)>2
)
SELECT * FROM BookCounts
UNION ALL
SELECT 10 AS Count, 'Thomas Cook' AS AuthorName, 'ABSPublisher' AS PublisherName;
This is my output:
+-------+---------------+-------------------+
| COUNT | AUTHORNAME | PUBLISHERNAME |
+-------+---------------+-------------------+
|4| Harvey Deitel | Prentice Hall |
|3| Harvey Deitel | Prentice Hall PTG |
|4| Paul Deitel | Prentice Hall |
|3| Sean Santry | Prentice Hall |
|5| Tem Nieto | Prentice Hall |
|3| Tem Nieto | Prentice Hall PTG |
|10| Thomas Cook | ABSPublisher |
+-------+---------------+-------------------+
Still the testcase is failing, Can you please help to fix this,
 For the attached query, i have written the below code. WITH

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!