Here is my clipboard content. Same error.
SELECT StatusDate as YEAR, AssignedAgent as AGENT, FirstName As [FIRST, LAST]
FROM
(
SELECT License.AssignedAgent, License.id, License.FirstName, License.StatusDate
FROM License INNER JOIN Applications ON License.id = Applications.MasterID...
I'm getting this error from my server side ODBC driver. Never seen it before...
Error Executing Database Query.
Syntax error at token 0, line 0 offset 0.
And the attached message when using Access Run Query...
Man this was hard for me to get.
But I solved it using my server side code by looping over the set of agents and using the union keyword. The dynamic query it creates runs fast and give me the desired result.
I never figured out how to do it in pure sql.
Select Top 5...
Select TOP 5 Applications.ApplicationYear, License.* FROM Applications, License Where Applications.MasterID=License.ID And Applications.ApplicationStatus='PENDING' And Applications.ApplicationYear>='2018' And License.AssignedAgent='AMK' Order By Applications.ApplicationYear
Lyndon
Andy,
I finally some time to address this...
I tried your idea of using a hard coded agentID.
This query returns correct data, but I get 10 records instead of 5? If it would return 5 I will be able to do it from there...
Select TOP 5 Applications.ApplicationYear, License.*
FROM...
strongm
this one?
It seemed to lock up like an infinite loop of something. So I never got any output.
SELECT *
FROM (SELECT DISTINCT License.*, Applications.ApplicationYear
FROM License INNER JOIN Applications ON License.ID = Applications.MasterID) AS m
WHERE ApplicationYear IN
(
SELECT TOP 5...
Andy
I saw what you wrote, but did not know how to make the term "WHERE L.AssignedAgent = 1234" Dynamic as I don't know what agents may have eligible records. I tried use my server side code to construct a dynamic union query, but it ran too slow.
Lyndon
Today I should have only gotten 30 records. At 8 AM I was getting all 384 currently pending records. Where I need only the five oldest records per agent.
Application Table (is a child table, new record for each customer Status Change statusSet{Pending, Approved, Denied...})
MasterID (is...
The group of assigned agents would be dynamic. Today I have 6 agents with a pending record, yesterday it was 5.
If an agent has no pending work, they are not on the list.
Lyndon
Sorry, I had one of those days lost to meetings!
The "INNER" term stopped the error; Thanks strongm! However, I'm not getting the row count I expected. So I changed the row count to 5. I know I have 5 assigned agents so I expected to get 25 rows back.
I'm getting 384 rows. If I correctly...
Please see
[link http://www.tek-tips.com/viewthread.cfm?qid=1791231]Thread Incorrectly Created in SQL Forum[/url] for start of thread.
Still getting syntax error in query
Select License.*, Applications.ApplicationYear
From License, Applications
Where License.ID=Applications.MasterID
And...
Still getting syntax error in query expression
Select License.*, Applications.ApplicationYear
From License, Applications
Where License.ID=Applications.MasterID
And License.Status='PENDING'
And Applications.ApplicationYear >= '2018'
And License.id IN
(
SELECT TOP 50 License.id
FROM...
Here's another idea. My primary key is the auto-populate numeric column "ID". Is the "IN" clause supposed to evaluate a comma delimited set of some kind?
Sorry if I'm grasping...
Lyndon
Thanks Duane, I just tried the example this error:
in query expression . (Error 3075)
I haven't spotted a misspelled column name.
Lyndonhttps://files.engineering.com/getfile.aspx?folder=b3f40ee4-30c7-432f-8331-268141a5b827&file=accessError.JPG
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.