none
How to make MonthName instead of Month integer value in a query

    Question

  • Sir,

    I tried both codes as below specified.  Both r giving almost same result.  I need MonthName instead of eMonth column values as the same sorting order.  (Because I want to use this DataSet for grid's DataSource)

    SELECT Year(edate) As eYear, Month(edate) As eMonth, Sum(receipt) as ReceiptTotal, Sum(payment) as PaymentTotal FROM entries " & DataFilterCondition & " GROUP BY Year(edate), Month(edate)
    SELECT Year(edate) As eYear, Val(Format(edate,'m')) As eMonth, Sum(receipt) as ReceiptTotal, Sum(payment) as PaymentTotal FROM entries " & DataFilterCondition & " GROUP BY Year(edate), Val(Format(edate,'m'))

    I am writing below it's result.

    eYear    eMonth      ReceiptTotal     PaymentTotal

    -----------------------------------------------------------

    2015              4        25,000.00                  0.00

    2015              5             500.00                  0.00

    2015             12       50,000.00                  0.00

    2016               1         5,000.00                  0.00

    2016               6       41,000.00           9,154.50

    ==============================

    And I need the result as below mentioned.

    eYear    eMonth      ReceiptTotal     PaymentTotal

    -----------------------------------------------------------

    2015    April              25,000.00                  0.00

    2015    May                    500.00                  0.00

    2015    December      50,000.00                  0.00

    2016    January           5,000.00                  0.00

    2016    June              41,000.00           9,154.50

    ==============================

    Which means just I need to replace only the integer month with it's month name as the same sorting order as I shown above.

    Thanks in advance dear experts.



    Thursday, June 23, 2016 7:52 PM

Answers