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 2063
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 well for years but now there's a need
for a much more powerful banner rotation.
At first I thought to buy some banner management app but after some time I
realized that phpMyAdmin is the best thing.
The problem is PMA uses MySQL. I can install...
|
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 understanding of their structure. I cannot find anything akin to MySQL's mysqldump for mssql and have been looking for that among other help in being able to use my MySQL experience as a base for learning MSSQL. I have spent a few days (8 to 9 hours per day)...
|
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 to use the PEAR MDB2 methods rather than mysqli.
Everything still works fine with MySQL, but I have an odd problem when I
test against MSSQL.
Any database query which does not return a resultset is OK e.g. an
update works fine. If I execute a...
| |
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 install ODBC MySQL 3.51
configuring system DSN
add a linked server on MSSQL 2005
|
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 mysql....
I have installed and configured mysql correctly and all the libraries and namespaces working fine for mysql in my existing application... and also using the quick replace facility i have changed the namespaces i.e from System.data.sqlclient 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? Won't it make any problems?
Can I use 4CRM SQL 5.1.4 or EMS MS SQL Manager Lite 1.8 to run my MSSQL web application? How to run it?
(In the web application I've got two directories. One which I copied to htdocs on KFWS, the other with scripts. At the...
|
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 things (stored procedures, functions).. we have to manually edit.
That time, we face some interesting challenges.. I failed to document all of them, but whatever I can share with u.. I will try.. :)
...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |