I'm working with classic ASP, that's the error:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression '1 LIMIT 1'.
The query is:
sql = "SELECT * FROM prezzi LIMIT 15 ORDER BY posizione"
Without LIMIT 15 it works but I need to paginate all the results.
What's wrong?
If the database is Access as you indicate then the query would be :
SELECT TOP 15 * FROM prezzi ORDER BY posizione
Limit is a MySQL construct, not an Access one.
Related
select distinct search_text,language, input_encode
from visitors
where unique_id='njZ3AWt7vmLcrGC2uOqnCplkm'
order by visitors_id desc
limit 9;
The above SQL is invalid. I get the following error when I run it on MySql Server version: 8.0.19
Your Recent searches:Error: Expression #1 of ORDER BY clause is not in SELECT list, references column 'visitors.visitors_id' which is not in SELECT list; this is incompatible with DISTINCT.
Makes sense.
But, when I execute the same SQL on Server version: 10.1.45-MariaDB guess what happens?
I get a result set. Can anyone explain how this could be?
I'm migrating somebody else's View from an Oracle DB to a Mysql DB. I'm not familiar with the table(cast(multiset())) operator and so I have no clue how to transpose it to MySql
The part of the code that gives me an error is the following:
SELECT csCOUNTRY.ID, csCOUNTRY.COUNTRY_ID,
trim(regexp_substr(COUNTRY_ID, '[^;]+', 1, levels.column_value)) AS COUNTRY_ID_2
FROM table_study csCOUNTRY,
table(
cast(
multiset(select level from dual connect by level <= length (REGEXP_REPLACE(COUNTRY_ID, '[^;]+')) + 1) as sys.OdciNumberList)
)
levels)
The error I recive is:
#1064 - You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near 'table(cast(multiset(select level from dual connect by level <=
length (REGEXP_R' at line 255
How can I transpose it correctly?
Multicast converts rows into a single table-type. Oracle table's column type can be standard Oracle SQL Types(number, char, varchar2) or user defined table types.
But, here the cast and multicast operator is redundant.
Below query should give same result :
SELECT csCOUNTRY.ID, csCOUNTRY.COUNTRY_ID,
trim(regexp_substr(COUNTRY_ID, '[^;]+', 1, levels.lvl)) AS COUNTRY_ID_2
FROM table_study csCOUNTRY,
(select level lvl
from dual
connect by level <= length (REGEXP_REPLACE(COUNTRY_ID, '[^;]+'))) levels
We are trying to get the length of a physical exercise by using the timestamps on our sensor data.
We currently have the following query:
SELECT UNIX_TIMESTAMP(
SELECT HAAS2.trainingsdata.timestamp
FROM HAAS2.trainingdata
WHERE HAAS2.trainingsdata.training_id= 1
ORDER BY timestamp DESC LIMIT 1)
- UNIX_TIMESTAMP(
SELECT HAAS2.trainingsdata.timestamp
FROM HAAS2.trainingdata
WHERE HAAS2.trainingsdata.training_id= 1
ORDER BY timestamp ASC LIMIT 1)
AS output
(enters added for readability)
When testing this query in phpMyAdmin we get the following error:
#1064 - You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near 'SELECT HAAS2.trainingsdata.timestamp FROM HAAS2.trainingdata
WHERE HAAS2.trainin' at line 1
We've tried different ways to write down the query all resulting in the same error. We don't understand where the syntax error lies.
SELECT max(UNIX_TIMESTAMP(timestamp)) -
min(UNIX_TIMESTAMP(timestamp)) AS output
FROM HAAS2.trainingdata
WHERE training_id = 1
I am trying to pull data from Mysql server using SQL server OPENQUERY function. When I run a query to count the records that are in thew mysql server I get the value no problem
-this query works and it return the total records found
SELECT count(*) AS total FROM OPENQUERY(LinkedServer, 'SELECT * FROM mydb_name.users')
But when I do
SELECT login_user FROM OPENQUERY(LinkedServer, 'SELECT * FROM mydb_name.users')
I get this error
Msg 7347, Level 16, State 1, Line 1
OLE DB provider 'MSDASQL' for linked server 'LinkedServer' returned data that does not match expected data length for column '[MSDASQL].login_user'. The (maximum) expected data length is 60, while the returned data length is 16.
I have tried but did not work
SELECT CONVERT(CHAR(60), login_user) AS name FROM OPENQUERY(LASWEB, 'SELECT * FROM mydb_name.users')
I am assuming it is a data type issue but how can I around it? How can I pull the data that I need?
Thanks
Cast the variable like so worked
SELECT login_user FROM OPENQUERY(LASWEB, 'SELECT CAST(u.login_user AS CHAR) AS login_user FROM mydb_name.users AS u')
try this:
SELECT * FROM OPENQUERY(LinkedServer, 'SELECT login_user FROM mydb_name.users')
I got this error when I'm trying a script.
mySQL query error: SELECT * FROM ibf_store_shopstock WHERE is_hidden='0' AND category=1 ORDER BY item_name ASC LIMIT 0,
mySQL error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
mySQL error code:
Date: Monday 23rd 2012f July 2012 05:37:44 PM`
This is odd, since the very same script I tried on my localhost (MySQL 5.5.14) works just fine, but when I try it on live server (MySQL 5.1.63), it results in this error. I thought there's no big difference between the MySQL version?
Anyway here is a part of the suspected script (it's quite long):
http://pastebin.com/YaQwVPqT
I think you are missing something after LIMIT clause "LIMIT start_record", "offset"
try
SELECT *
FROM ibf_store_shopstock
WHERE is_hidden='0' AND
category=1
ORDER BY item_name ASC
LIMIT 0, 10;