Results 1 to 1 of 1
  1. #1
    Join Date
    Mar 2011

    Unanswered: Is it possible to assign an expression to an alias?

    Hallo. This is my first post but when I have some db problem google often brings me here

    Now I make an example of my problem.
    Let's suppose I want to make a sum on a field based on last month records.

    This is my code.

    sum(IIf(format(date_field,"yyyymm")=format(dateadd("m",-1,now()),"yyyymm"),my_field,0)) as last_month ....
    However I'd like that if I run this code on march, my alias would be equal to "Feb 2011", if I run on may it would be "Apr 2011" and so on.
    Is it possible to assign to an alias an expression like

    format(dateadd("m",-1,now()),"mmm yyyy")
    ? Thanks in advance.
    Last edited by john_revelator; 03-21-11 at 20:12.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts