sql server - MSSQL to MYSQL conversion -


this question has answer here:

i have mssql query , convert mysql version. have error in console:

#1064 - have error in sql syntax; check manual corresponds mysql server version right syntax use near 'declare @selectedtags table (id int) declare @tagcount int inser' @ line 1 

my code below:

declare @selectedtags table (id int) declare @tagcount int  insert @selectedtags values (1) insert @selectedtags values (3) insert @selectedtags values (5)  select @tagcount = count(*) @selectedtags  select     p.id product p join producttag pt     on pt.productid = p.id join @selectedtags t     on t.id = pt.tagid group     p.id,     p.name having count(pt.tagid) = @tagcount 

there no table type in mysql, have create temporary table , insert it.

declare allowed in stored routines only.
set @tagcount use

select count(*) @tagcount temp_table; 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -