I have this such query :
SELECT au_lname,der.col FROM authors INNER JOIN (SELECT t.au_id, COUNT(title_id) AS 'col'
FROM titleauthor t GROUP BY t.au_id) der ON authors.au_id=der.au_id
I want write this with let operator.How I can do this?
thanks
I see no good reason to use
lethere. You can just use a group join.You could use
letfor the count here, I suppose:Or you could use a more direct translation of your original query: