Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-28449

Ability to alias group expressions

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Major
    • 6.5.0
    • 5.5.0
    • query
    • None

    Description

      SELECT month, COUNT(*) AS order_count
      FROM orders AS o
      GROUP BY DATE_PART_STR(o.order_date, "month") AS month;
       
      This is a valid query in Analytics, but in N1QL I would have to write it as follows:
       
      SELECT DATE_PART_STR(o.order_date, "month") AS month, 
          COUNT(*) AS order_count
      FROM orders AS o
      GROUP BY DATE_PART_STR(o.order_date, "month");
       
      I don't like having to write the expression DATE_PART_STR(o.order_date, "month") twice--that's what aliases are for. Do you think that N1QL users would appreciate aliases in the GROUP BY clause, as in Analytics?
      
      

      Attachments

        Issue Links

          For Gerrit Dashboard: MB-28449
          # Subject Branch Project Status CR V

          Activity

            People

              ajay.bhullar Ajay Bhullar
              Sitaram.Vemulapalli Sitaram Vemulapalli
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty