Click here to Skip to main content
15,890,609 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
GRAD_RESULT AS
(
SELECT IDNO,FNAME,LNAME,CODE1,LEVEL1,
TRANCODE,DESCPN,CATEGORY,
VALUE1,FPVALUE,BASWAGCON,
TAXSTATUS,SSFCAL,
DMPERCENT,DESCPTN,
SPEC_TIME,STAT_MTH,
STAT_YR,END_MTH,END_YR
FROM GRAD_MOLD
WHERE
(IDNO + LTRIM(TRANCODE)) NOT IN
(SELECT (IDNO + LTRIM(TRANCODE)) FROM XTRANS_COMB WHERE CATEGORY=[UNIQ])
),

What am I doing wrong

What I have tried:

This is a program under development with this requirement.
Posted
Updated 4-Nov-19 7:02am

1 solution

The error code much some it up; your query is referencing a column UNIQ that does not exist in the table.

This is found within the subquery of your CTE
(SELECT (IDNO + LTRIM(TRANCODE)) FROM XTRANS_COMB WHERE CATEGORY=[UNIQ])

How to fix... Well that depends on what UNIQ really is/means:

If this is meant to be a text comparison with the value UNIQ then the clause should be
WHERE Category = 'UNIQ'

Or is this supposed to be some reference eluding to the fact that you are seeking Unique values? This would change the SELECT portion of the statement to include the DISTINCT keyword.

If you need additional assistance, you would probably want to edit (improve) question and add in the business requirement that you are attempting to fulfil
 
Share this answer
 
Comments
Member 12770648 4-Nov-19 15:29pm    
If this is meant to be a text comparison with the value UNIQ then the clause should be
WHERE Category = 'UNIQ'

Yes Exactly.
MadMyche 4-Nov-19 15:43pm    
Then this is solved.... You need to change it from [UNIQ] (which is a column name) to 'UNIQ' (which is the value sought).
Please rate this question and mark it as resolved

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900