Re: MSSQL to MySQL
MySQL 4.1 and later versions support subqueries.
You can get your MySQL version with: "SHOW VARIABLES LIKE 'version';"
If it's 4.0 or less, you can't use subqueries.
However, you should be able to rewrite this query without subqueries, and it may even run faster this way:
SELECT o.*,
i.ItmName, i.CategoryID, i.ClientID,
c.CatName AS CategoryName,
CONCAT(cl.FName, ' ', cl.LName) AS ClientName,
it.ItmName AS ItemTYpeName,
it.RecordID AS ItemTypeID
FROM Offers AS o
INNER JOIN Items AS i ON i.RecordID = o.ItemID
INNER JOIN Categories AS c ON c.RecordID = i.CategoryID
INNER JOIN Clients AS cl ON cl.RecordID = i.ClientID
INNER JOIN ItemTypes AS it ON it.RecordID = i.ItmType
ORDER BY o.DteAdded DESC
Note also the use of CONCAT() instead of the Microsoft-proprietary '+' syntax for string concatentation.
Regards,
Bill K.
Subject
Written By
Posted
Re: MSSQL to MySQL
April 05, 2006 11:05AM
Sorry, you can't reply to this topic. It has been closed.
This forum is currently read only. You can not log in or make any changes. This is a temporary situation.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.