Select Command failing

  • Thread starter Thread starter Brad Allison
  • Start date Start date
B

Brad Allison

Here is the command:

SELECT FirstName, LastName, State, CJNYtd
TOP 10 WITH TIES
ORDER BY CJNYtd DESC
FROM JuniorMaster
WHERE (Region=?)

This is the error:
Error in SELECT Clause: Expression nead '10'
Unable to Parse...

I am using this select command to draw data from an Access Database using
the OleDB Jet provider. Maybe there is a syntax error.

Thanks for any help you may provide.

Brad
 
Miha,

You are always quick with a response - thank you.

I was searching in the library help files and there is an argument called
WITH TIES. This is copied from the library:

WITH TIES

Specifies that additional rows be return from the base result set with the
same value in the ORDER BY columns appearing as the last of the TOP n
(PERCENT) rows. TOP...WITH TIES can only be specified if an ORBER BY clause
is specified.

I will rearrange the command per your specifications and see what happens.

Brad
 
Hi Brad,
TOP 10 should be right after SELECT key.
What the heck is WITH TIES?
The right order would be:
select top 10 ... from ... where ... order by ...
 
Miha,

When I do not enclose TOP 10 in brackets, I get an error message, but when I
do enclose TOP 10 with brackets [TOP 10], I just get a general Unable to
Parse error. Is this because I am using OleDB?

Brad
 
What does you statament look now?

--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

Brad Allison said:
Miha,

When I do not enclose TOP 10 in brackets, I get an error message, but when I
do enclose TOP 10 with brackets [TOP 10], I just get a general Unable to
Parse error. Is this because I am using OleDB?

Brad

Miha Markic said:
Hi Brad,
TOP 10 should be right after SELECT key.
What the heck is WITH TIES?
The right order would be:
select top 10 ... from ... where ... order by ...
 
Mihda,

When I do this I do not get an error message:

SELECT
FirstName,
LastName,
State,
CJNYtd
FROM
JuniorMaster
WHERE (Region=?)
ORDER BY CJNYtd DESC

With this I get the following error message:
Syntax error (missing operator) in query expression '[TOP 10]
FirstName'.

SELECT [TOP 10]
FirstName,
LastName,
State,
CJNYtd
FROM
JuniorMaster
WHERE (Region=?)
ORDER BY CJNYtd DESC

When I have the statement without the brackets I get this error message:
Error in SELECT clause: expression near '10'.
Missing FROM clause.
Error in SELECT clause: expression near ','.
Unable to parse query text.

So currently I have not gotten any further.

Brad

Miha Markic said:
What does you statament look now?

--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

Brad Allison said:
Miha,

When I do not enclose TOP 10 in brackets, I get an error message, but
when
I
do enclose TOP 10 with brackets [TOP 10], I just get a general Unable to
Parse error. Is this because I am using OleDB?

Brad

Miha Markic said:
Hi Brad,
TOP 10 should be right after SELECT key.
What the heck is WITH TIES?
The right order would be:
select top 10 ... from ... where ... order by ...

--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

Here is the command:

SELECT FirstName, LastName, State, CJNYtd
TOP 10 WITH TIES
ORDER BY CJNYtd DESC
FROM JuniorMaster
WHERE (Region=?)

This is the error:
Error in SELECT Clause: Expression nead '10'
Unable to Parse...

I am using this select command to draw data from an Access Database using
the OleDB Jet provider. Maybe there is a syntax error.

Thanks for any help you may provide.

Brad
 
Hi Brad,

SELECT TOP 10
is just fine. Only the wizard can't understand it, right?
However, from the code there should be no problem.

--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com



Brad Allison said:
Mihda,

When I do this I do not get an error message:

SELECT
FirstName,
LastName,
State,
CJNYtd
FROM
JuniorMaster
WHERE (Region=?)
ORDER BY CJNYtd DESC

With this I get the following error message:
Syntax error (missing operator) in query expression '[TOP 10]
FirstName'.

SELECT [TOP 10]
FirstName,
LastName,
State,
CJNYtd
FROM
JuniorMaster
WHERE (Region=?)
ORDER BY CJNYtd DESC

When I have the statement without the brackets I get this error message:
Error in SELECT clause: expression near '10'.
Missing FROM clause.
Error in SELECT clause: expression near ','.
Unable to parse query text.

So currently I have not gotten any further.

Brad

Miha Markic said:
What does you statament look now?

--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

Brad Allison said:
Miha,

When I do not enclose TOP 10 in brackets, I get an error message, but
when
I
do enclose TOP 10 with brackets [TOP 10], I just get a general Unable to
Parse error. Is this because I am using OleDB?

Brad

"Miha Markic" <miha at rthand com> wrote in message
Hi Brad,
TOP 10 should be right after SELECT key.
What the heck is WITH TIES?
The right order would be:
select top 10 ... from ... where ... order by ...

--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

Here is the command:

SELECT FirstName, LastName, State, CJNYtd
TOP 10 WITH TIES
ORDER BY CJNYtd DESC
FROM JuniorMaster
WHERE (Region=?)

This is the error:
Error in SELECT Clause: Expression nead '10'
Unable to Parse...

I am using this select command to draw data from an Access Database
using
the OleDB Jet provider. Maybe there is a syntax error.

Thanks for any help you may provide.

Brad
 
Yes, I am building this throuigh the wizard so I just tried it through code
and I still get an error.

Miha Markic said:
Hi Brad,

SELECT TOP 10
is just fine. Only the wizard can't understand it, right?
However, from the code there should be no problem.

--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com



Brad Allison said:
Mihda,

When I do this I do not get an error message:

SELECT
FirstName,
LastName,
State,
CJNYtd
FROM
JuniorMaster
WHERE (Region=?)
ORDER BY CJNYtd DESC

With this I get the following error message:
Syntax error (missing operator) in query expression '[TOP 10]
FirstName'.

SELECT [TOP 10]
FirstName,
LastName,
State,
CJNYtd
FROM
JuniorMaster
WHERE (Region=?)
ORDER BY CJNYtd DESC

When I have the statement without the brackets I get this error message:
Error in SELECT clause: expression near '10'.
Missing FROM clause.
Error in SELECT clause: expression near ','.
Unable to parse query text.

So currently I have not gotten any further.

Brad

Miha Markic said:
What does you statament look now?

--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

Miha,

When I do not enclose TOP 10 in brackets, I get an error message,
but
when
I
do enclose TOP 10 with brackets [TOP 10], I just get a general
Unable
 
Back
Top