Child pages
  • [in-commerce] Possible SQL error on order list in Admin Console [5.2.2-B1]
Skip to end of metadata
Go to start of metadata

The data, that is displayed in Admin Console is stored in the database. Sometimes however just displaying data from database isn't enough and some computed data like "order total" (sub-total + shipping + taxes) needs to be displayed as well. The mechanism for calculating such data is called "calculated fields". For each calculated field a formula is defined, that would allow, once executed, to displayed calculated field value to the user. For example formula for "Username" calculated field in orders unit looks like this:

IF( ISNULL(u.Username),"root",IF(u.Username = "", u.Email, u.Username))

It's important to note, that each field used in the formula must be prefixed with a table alias indicating where it's coming from to avoid any future errors due 2 used tables having fields named the same.

In the orders unit however almost none of the fields are prefixed with table name, which results in following SQL error, when somebody wants to display relevant order information (e.g. by doing JOIN to orders table) right in the list of orders:

Fatal Error: Column 'Number' in field list is ambiguous (1052)


Add missing table aliases to the formulas used in order's calculated fields.

Related Discussions

Related Tasks

MINC-143 - Getting issue details... STATUS