I'm trying to convert a MSSQL select statement to MySQL, but am having difficulty with the following section: -
...
-
INNER JOIN tableA ON tableB.field1 = tableA.field1
-
INNER JOIN tableC ON tableA.field2 = tableC.field2
-
ON tableD.field4 = tableB.field4
-
ON tableE.field5 = tableC.field5
-
ON tableF.field6 = tableB.field6
-
ORDER BY tableD.field7 DESC
-
LIMIT 0,100
-
Result:
#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 'ON tableF.field6 = tableB.field6 ORDER BY'
The MSSQL code works perfectly in MSSQL, but MySQL doesn't like the syntax of the last section. Is there anyone who would be willing to assist?
I'm using Mysql 5.0.38.
Thanks in advance
7 2028
I'm trying to convert a MSSQL select statement to MySQL, but am having difficulty with the following section: -
...
-
INNER JOIN tableA ON tableB.field1 = tableA.field1
-
INNER JOIN tableC ON tableA.field2 = tableC.field2
-
ON tableD.field4 = tableB.field4
-
ON tableE.field5 = tableC.field5
-
ON tableF.field6 = tableB.field6
-
ORDER BY tableD.field.7 DESC
-
LIMIT 0,100
-
Result:
#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 'ON tableF.field6 = tableB.field6 ORDER BY'
The MSSQL code works perfectly in MSSQL, but MySQL doesn't like the syntax of the last section. Is there anyone who would be willing to assist?
I'm using Mysql 5.0.38.
Thanks in advance
Do you have it as ORDER BY tableD.field.7 or ORDER BY tableD.field7 ?
Do you have it as ORDER BY tableD.field.7 or ORDER BY tableD.field7 ?
That was a typo - sorry. It should read "ORDER BY tableD.field7 DESC". I've rectified it in my original post.
I'm trying to convert a MSSQL select statement to MySQL, but am having difficulty with the following section: -
...
-
INNER JOIN tableA ON tableB.field1 = tableA.field1
-
INNER JOIN tableC ON tableA.field2 = tableC.field2
-
ON tableD.field4 = tableB.field4
-
ON tableE.field5 = tableC.field5
-
ON tableF.field6 = tableB.field6
-
ORDER BY tableD.field7 DESC
-
LIMIT 0,100
-
Result:
#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 'ON tableF.field6 = tableB.field6 ORDER BY'
The MSSQL code works perfectly in MSSQL, but MySQL doesn't like the syntax of the last section. Is there anyone who would be willing to assist?
I'm using Mysql 5.0.38.
Thanks in advance
Try it as - INNER JOIN tableA ON tableB.field1 = tableA.field1
-
INNER JOIN tableC ON tableA.field2 = tableC.field2
-
ON (tableD.field4 = tableB.field4
-
and tableE.field5 = tableC.field5
-
and tableF.field6 = tableB.field6)
-
ORDER BY tableD.field7 DESC
-
LIMIT 0,100
and post any error messages you get
I've added the brackets and replaced the ON with AND, but the error remains much the same:
#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 'ORDER BY tableD.field7 DESC
LIMIT 0,' at line 36
I think I've tried this already, based on what I read on mysql.com and the correct syntax for JOINS.
I've added the brackets and replaced the ON with AND, but the error remains much the same:
#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 'ORDER BY tableD.field7 DESC
LIMIT 0,' at line 36
I think I've tried this already, based on what I read on mysql.com and the correct syntax for JOINS.
There is still another ON that needs to be replaced by AND in the code that I gave you.
There is still another ON that needs to be replaced by AND in the code that I gave you.
Just looking on you query again. Which table are you selecting from?
Shouldn't you have it as - from tableName innner join tableA on (tableName.field = tableA.field and tableName.anotherField = tableA.anotherField and e.t.c)
-
innner join tableB on (tableName.field = tableB.field)
-
inner joing tableC on (tableName.field = tableC.field)
-
e.t.c
-
Selection is made FROM tableF. Will try rewriting this statement from scratch, the MSSQL was done by someone else.
Just looking on you query again. Which table are you selecting from?
Shouldn't you have it as - from tableName innner join tableA on (tableName.field = tableA.field and tableName.anotherField = tableA.anotherField and e.t.c)
-
innner join tableB on (tableName.field = tableB.field)
-
inner joing tableC on (tableName.field = tableC.field)
-
e.t.c
-
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Alper Adatoz |
last post by:
Hi,
i have a little problem. i hope u guys give me a clear solution (:
db: mssql
i just want to put jpeg file to the image field at the mssql db.
and after that i want to call it back..
|
by: Gordan |
last post by:
Hi,
I have a site written in PHP with MS SQL Server 2000 as the db backend. When
the site was made there was no need for advanced banner rotation so a 10
line script was written and it served...
|
by: davemateer |
last post by:
Hi
We have a current system:
Linux / Apache / PHP4.x talking to Microsoft SQL 2000
Thinking about going to:
Windows 2003 / PHP4.x talking to the same Microsoft SQL 2000 box...
|
by: m3rajk |
last post by:
I've recently become the defacto DBA of two MSSQL databases at work because I am the only one with SQL experience. I have been asked to do some tasks with the databases but this requires and...
|
by: exclaim |
last post by:
Apologies if this is not the right forum.
I have an application written originally to work with MySQL which now
has to be extended to work with MSSQL also. I have modified all my
database calls...
|
by: Gosth in the shell |
last post by:
Hi there, i need some help
I got a software to backend is MSSQL 2005, but a provider software
requires an UPDATE on his table with MySQL 5.0.56a backend, so i made
the next:
download and...
|
by: rajanji |
last post by:
Hi All,
Hw r u ???? Hope u all r doing gr8...
Actually i have designed a website on jobportal in asp.net using sqlserver 2005 as a backend... and now m trying to convert its database to...
|
by: johnyjj2 |
last post by:
Hello!
I've got web application written in MSSQL and I need to run it on server. But on the server I've go MySQL (not MSSQL), PHP, KFWS.
Do I have to install MSSQL and have both MySQL and MSSQL?...
|
by: ssnaik84 |
last post by:
Hi Guys,
Last year I got a chance to work with R&D team, which was working on DB scripts conversion..
Though there is migration tool available, it converts only tables and constraints..
Rest of...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |