I'm trying to do a complicated SQL, where I write all categories, how many threads are in the category on the page. Now i'm also trying to make it, so my Repeater, shows the latest thread in the category, based on Thread Datetime.
This is my SQL:
SELECT categories.category_name, categories.category_id,
COUNT(threads.thread_category_id)
AS 'threadCount' FROM threads
RIGHT OUTER JOIN categories
ON categories.category_id = threads.thread_category_id
GROUP BY categories.category_name, categories.category_id
I've been trying different ways, and also asked my teacher. We can't seem to find a way to make this possible, into one SQL Query, to run in a Repeater.
Basiclly: Repeater that contains every Category with a
Category name,
Category ID,
Count of threads in Category,
Latest Thread title,
Latest Thread datetime.
Thread title DB field: threads.thread_title
Thread datetime DB field:threads.thread_datetime
Would appreciate any idea or help on this!