Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6987801
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:59:10+00:00 2026-05-27T18:59:10+00:00

I have a SQL which I am trying to run in Informix but it

  • 0

I have a SQL which I am trying to run in Informix but it keeps on prompting either “Syntax error” or “Column (…) cannot be found in table..”.

My query is like below:

SELECT      SLS.STORE, ITM.CLASS, SUM(SLS.SLS_QTY) AS SUM_SLS_QTY, 
            SUM(SLS.SLS_COST) AS SUM_SLS_COST, SUM(SLS.SLS_SELL) AS SUM_SLS_SELL
FROM        SLSDATE SLS, ITEMMST ITM
WHERE       SLS.STORE = '1001' AND SLS.SHORT_SKU = ITM.SHORT_SKU AND 
            SLS.SALES_TRANS_DATE BETWEEN 
                TO_DATE('2011-04-01', '%Y-%m-%d') AND TO_DATE('2011-04-10', '%Y-%m-%d')
GROUP BY    SLS.STORE, ITM.CLASS
ORDER BY    SLS.STORE, ITM.CLASS;

When I run the query above, informix says “Column (class) not found in any table in the query (or SLV is undefined)”.

When I changed the ITM.CLASS to ITM.”CLASS” (as below), it says syntax error at the GROUP BY clause.

SELECT      SLS.STORE, ITM."CLASS", SUM(SLS.SLS_QTY) AS SUM_SLS_QTY, 
            SUM(SLS.SLS_COST) AS SUM_SLS_COST, SUM(SLS.SLS_SELL) AS SUM_SLS_SELL
FROM        SLSDATE SLS, ITEMMST ITM
WHERE       SLS.STORE = '1001' AND SLS.SHORT_SKU = ITM.SHORT_SKU AND 
            SLS.SALES_TRANS_DATE BETWEEN 
                TO_DATE('2011-04-01', '%Y-%m-%d') AND TO_DATE('2011-04-10', '%Y-%m-%d')
GROUP BY    SLS.STORE, ITM."CLASS"
                          ^ syntax error here
ORDER BY    SLS.STORE, ITM."CLASS";

Then I changed the GROUP BY clause to use numbers to represent the columns, and it was able to execute.

SELECT      SLS.STORE, ITM."CLASS", SUM(SLS.SLS_QTY) AS SUM_SLS_QTY, 
            SUM(SLS.SLS_COST) AS SUM_SLS_COST, SUM(SLS.SLS_SELL) AS SUM_SLS_SELL
FROM        SLSDATE SLS, ITEMMST ITM
WHERE       SLS.STORE = '1001' AND SLS.SHORT_SKU = ITM.SHORT_SKU AND 
            SLS.SALES_TRANS_DATE BETWEEN 
                TO_DATE('2011-04-01', '%Y-%m-%d') AND TO_DATE('2011-04-10', '%Y-%m-%d')
GROUP BY    1, 2
ORDER BY    SLS.STORE, ITM."CLASS";

At the moment I do not understand why is there problems with the GROUP BY clause.

UPDATE 1
The itemmst table schema looks something like below

create table 'informix'.itemmst (
    short_sku VARCHAR(13) not null,
    item_desc lvarchar(2000),
    item_del_cd VARCHAR(1),
    item_suppl VARCHAR(10),
    item_suppl_contract VARCHAR(10),
    div VARCHAR(3),
    dept VARCHAR(3),
    CLASS VARCHAR(6),
    ..
)

UPDATE 2
I did a change to one of WAS data source’s custom properties, ifxDELIMIDENT. Originally it was blank. So, I changed it to true. Restarted WAS. And I couldn’t login to our application. SQLExceptions were thrown by WAS but was not able to see the stack trace because WAS has truncated the last few lines. After changing the property back to blank, I was able to login to our application.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T18:59:11+00:00Added an answer on May 27, 2026 at 6:59 pm

    Informix treats both single-quotes and double-quotes are string delimiters, unless you force it to treat double quotes as marking delimited identifiers by setting the DELIMIDENT environment variable. Then strings are in single quotes and delimited identifiers are in double quotes. (You can still get away with either single or double quotes around owner names, even with DELIMIDENT set.)

    That’s why the "CLASS" notation is not working.

    The residual problem appears to be that there isn’t a column called class in the table itemmst. If you can demonstrate that it is there (by showing the schema for the itemmst table), then we have other issues. You will need to identify the version of Informix that you’re using (down the the last digit after the last decimal point – so 11.50.UC9W1X1 if that is the version you have), and also the platform on which you are running it. This should be information provided automatically, though you’re not the first, nor likely to be the last, to omit it.


    It’s hard work reverse engineering other people’s schemas. But, sometimes it has to be done!

    CREATE TEMP TABLE slsdate
    (
        store               VARCHAR(13) NOT NULL,
        sls_qty             DECIMAL(6,0) NOT NULL,
        sls_cost            DECIMAL(10,2) NOT NULL,
        sls_sell            DECIMAL(10,2) NOT NULL,
        short_sku           VARCHAR(13) NOT NULL,
        sales_trans_date    DATE NOT NULL
    );
    
    CREATE TEMP TABLE itemmst
    (
        short_sku           VARCHAR(13) NOT NULL,
        item_desc           LVARCHAR(2000),
    --    item_del_cd         VARCHAR(1),
    --    item_suppl          VARCHAR(10),
    --    item_suppl_contract VARCHAR(10),
    --    div                 VARCHAR(3),
    --    dept                VARCHAR(3),
        CLASS               VARCHAR(6)
    );
    
    SELECT      SLS.STORE, ITM.CLASS, SUM(SLS.SLS_QTY) AS SUM_SLS_QTY,
                SUM(SLS.SLS_COST) AS SUM_SLS_COST, SUM(SLS.SLS_SELL) AS SUM_SLS_SELL
    FROM        SLSDATE SLS, ITEMMST ITM
    WHERE       SLS.STORE = '1001' AND SLS.SHORT_SKU = ITM.SHORT_SKU AND
                SLS.SALES_TRANS_DATE BETWEEN TO_DATE('2011-04-01', '%Y-%m-%d')
                                         AND TO_DATE('2011-04-10', '%Y-%m-%d')
    GROUP BY    SLS.STORE, ITM.CLASS
    ORDER BY    SLS.STORE, ITM.CLASS;
    

    When I run that against IDS 11.70.FC2 on MacOS X 10.7.2 (using SQLCMD 87.02 and CSDK 3.70.FC2), I get no error (no data either, but then I didn’t insert any into either table).

    Which language are you using to get this SQL to the database?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following Linq to SQL query, in which I'm trying to do
I have an SQL question which may be basic to some but is confusing
Right now I have this SQL query which is valid but always times out:
I have an Informix SQL query which returns a set of rows. It was
I'm trying to determine what instances of sql server/sql express I have installed (either
I'm trying to run a webmethod via a jQuery which will query an SQL
So I'm trying to run some SQL here through PHP's PDO (which I don't
I have the below SQL Script which is run from Excel VBA using ADO
I have an SQL Server database and i am trying to run an update
I have a web service (JAX-RS/Spring) that generates SQL queries which run against a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.