1

Good Morning

I am Trying to Convert Sqlserver Join to Mysql server Join , Anyone please help me on this

Sql Server Code

 Update @ABC   
  Set grpId = g.GroupId
  From @ABC, luGroup g
  Where typeWrd = g.GroupName  
  and g.GroupTypeId = @gtid

Description :

@Abc    -- temporary table
luGroup -- Normal Table

Please help me to Convert this code to Mysql , i shall be thankful to you

Thanks Amandeep

3
  • Please post your table structure So I can help you. Commented Jul 24, 2018 at 5:43
  • Are @ABC and @workA meant to be the same table variable (not temp table)? Also, that's fairly bad original SQL Server code to start from. Whoever wrote it hasn't learnt that Standard SQL got explicit join syntax over a quarter of a century ago and any SQL database product you're likely to encounter these days has probably adopted this part of the standard decades ago. Commented Jul 24, 2018 at 5:58
  • @Damien_The_Unbeliever : Sorry , Now please check it I changed the code, Sorry again for Wrong Commented Jul 24, 2018 at 6:08

2 Answers 2

1

change the update from clause

Update @workA a    
INNER JOIN luGroup g ON a.typeWrd = g.GroupName  
AND g.GroupTypeId = @gtid
Set grpId = g.GroupId
Sign up to request clarification or add additional context in comments.

Comments

1

Crudely...

Update @ABC   
  From @workA, luGroup g

  Set grpId = g.GroupId

Where typeWrd = g.GroupName  
  and g.GroupTypeId = @gtid

1 Comment

Add small explanation even though code is explanatory

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.