I have the following table:
Ineedtobringonlytheoldestsaleoftheclient,regardlessofthetypeofsale,howeverIneedthetypeofsaletocomeinselect
,beforeIhadasimilarquestionandtheyhelpedmehereinStackOverflow,butraisingthelevelofstudies,Icameupwiththisproblem.
BeforeIhadthefollowingquery
anditworked,howeverIdidnothavethe"type" of the sale, now having the type of sale, it precludes the use of Group By
, as I could do:
SELECT
loja,
nome,
MONTH(data)
MIN(data)
FROM vendas
GROUP BY loja, nome, MONTH(data)
I need to get the following result: