Skip to content
Advertisement

filtering using having by clause result in unknown column in having clause

i have a table with these columns: order_date (in yyyy-mm-dd format), order_status, product_sub_category, sales. the data consists of transactions from 2009 onwards. what i want to do is to find the total sales of each product categories in between the year 2011 and 2012. to do that, i use these query:

the problem is that sql tells me unknown column ‘order_date’ in having clause

any solution? thank you

Advertisement

Answer

You can’t use having and where in the same query. Try This:

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement