Skip to content
Advertisement

SQL Query for records

I want to write a SQL query to get problem solution given below – I have a table something like this:

Pardon if something wrong with query but you get the idea.

Now I want sql query to give result like total income of users for year 2017 whose first order was created in 2016.

Advertisement

Answer

Your order table seems an odd design but given

a simple join might be all you need

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