Convert MS SQL querie Into MySQL querie

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
mysh_eireannach
Veteran Member
Posts: 35
Joined: 2016-02-16 22:31

Convert MS SQL querie Into MySQL querie

Post by mysh_eireannach » 2020-06-14 17:05

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]

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: Convert MS SQL querie Into MySQL querie

Post by pbottcher » 2020-06-14 19:01

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;
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

mysh_eireannach
Veteran Member
Posts: 35
Joined: 2016-02-16 22:31

Re: Convert MS SQL querie Into MySQL querie

Post by mysh_eireannach » 2020-06-14 21:36

Hi Pböttcher

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

Great job!

Post Reply