Page 1 of 1

Convert MS SQL querie Into MySQL querie

Posted: 2020-06-14 17:05
by mysh_eireannach
I'm trying to write query for calculated field but bit complicated for me this specific query Lost half day playing around, without breakthrough.
I got good result at MS SQL, but can't convert to MySQL without syntax errors.

Could anyone help please convert MS SQL query into MySQL syntax query.

Code: Select all

SELECT TOP 1 projects.id, projects.project_name
FROM equipment_list INNER JOIN (Equipment_manifest INNER JOIN projects ON Equipment_manifest.project = projects.id) ON equipment_list.Manifest_id = Equipment_manifest.id
GROUP BY projects.id, projects.project_name, equipment_list.Item_id
HAVING (((equipment_list.Item_id)=%ID%))
ORDER BY Max(equipment_list.id) DESC;
/code]

Re: Convert MS SQL querie Into MySQL querie

Posted: 2020-06-14 19:01
by pbottcher
Hi,

try

Code: Select all

SELECT projects.id, projects.project_name
FROM equipment_list INNER JOIN (Equipment_manifest INNER JOIN projects ON Equipment_manifest.project = projects.id) ON equipment_list.Manifest_id = Equipment_manifest.id
GROUP BY projects.id, projects.project_name, equipment_list.Item_id
HAVING (((equipment_list.Item_id)=%ID%))
ORDER BY Max(equipment_list.id) DESC LIMIT 1;

Re: Convert MS SQL querie Into MySQL querie

Posted: 2020-06-14 21:36
by mysh_eireannach
Hi Pböttcher

Thanks so much for help! All tested and work as should.

Great job!