This error can be very misleading. It may have nothing to do with the database table not having the column.
I had a Crystal Report query as below, and it kept throwing such error util I modified the query.
WITH preResult1 AS (
select
max(age) as age,
personDeptId,
personId,
personName
from person, department
where personDeptId = deptId
group by personDeptId, personId, personName
),
preResult2 as (
select
age,
personDeptId,
personId,
personName,
ROW_NUMBER() OVER (PARTITION BY personDeptId ORDER BY age desc) as age_rank
from preResult1
)
SELECT
personName,
age,
numberOfTitles,
awardsReceived
FROM preResult2
INNER JOIN activity on preResult2.personId = activity.personId
WHERE age_rank <= 5
After I modified the query as shown below, the error was gone.
WITH preResult1 AS (
select
max(age) as age,
personDeptId,
personId,
personName,
numberOfTitles,
awardsReceived
from person, department, activity
where personDeptId = deptId and person.personId = activity.personId
group by personDeptId, personId, personName, numberOfTitles, awardsReceived
),
preResult2 as (
select
age,
personDeptId,
personId,
personName,
numberOfTitles,
awardsReceived,
ROW_NUMBER() OVER (PARTITION BY personDeptId ORDER BY age desc) as age_rank
from preResult1
)
SELECT
personName,
age,
numberOfTitles,
awardsReceived,
FROM preResult2
WHERE age_rank <= 5
I had a Crystal Report query as below, and it kept throwing such error util I modified the query.
WITH preResult1 AS (
select
max(age) as age,
personDeptId,
personId,
personName
from person, department
where personDeptId = deptId
group by personDeptId, personId, personName
),
preResult2 as (
select
age,
personDeptId,
personId,
personName,
ROW_NUMBER() OVER (PARTITION BY personDeptId ORDER BY age desc) as age_rank
from preResult1
)
SELECT
personName,
age,
numberOfTitles,
awardsReceived
FROM preResult2
INNER JOIN activity on preResult2.personId = activity.personId
WHERE age_rank <= 5
After I modified the query as shown below, the error was gone.
WITH preResult1 AS (
select
max(age) as age,
personDeptId,
personId,
personName,
numberOfTitles,
awardsReceived
from person, department, activity
where personDeptId = deptId and person.personId = activity.personId
group by personDeptId, personId, personName, numberOfTitles, awardsReceived
),
preResult2 as (
select
age,
personDeptId,
personId,
personName,
numberOfTitles,
awardsReceived,
ROW_NUMBER() OVER (PARTITION BY personDeptId ORDER BY age desc) as age_rank
from preResult1
)
SELECT
personName,
age,
numberOfTitles,
awardsReceived,
FROM preResult2
WHERE age_rank <= 5
-----------------------------------------------------------------------------------------------------------------
Watch the blessing and loving online channel: SupremeMasterTV live
If you have ever asked yourself these questions, this is the book for you. What is the meaning of life? Why do people suffer? What is in control of my life? Why is life the way it is? How can I stop suffering and be happy? How can I have a successful life? How can I have a life I like to have? How can I be the person I like to be? How can I be wiser and smarter? How can I have good and harmonious relations with others? Why do people meditate to achieve enlightenment? What is the true meaning of spiritual practice? Why all beings are one? Read the book for free here.
No comments:
Post a Comment