0

I am using following query

select month(datee) as [Month], year(datee) as [Year] from ledger_broker group by month(datee),year(datee) 

Output : Output

What's the query to combine both columns and show as

1-2016 2-2016 

OR

Jan-2016 Feb-2016 

1 Answer 1

2

Use a Format() expression to format the month plus year as you wish. For months as digits, this should work:

SELECT DISTINCT Format(datee, 'm-yyyy') AS month_year FROM ledger_broker ORDER BY Month(datee), Year(datee); 

For abbreviated month names, adjust the Format pattern:

SELECT DISTINCT Format(datee, 'mmm-yyyy') AS month_year 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.