SQL SERVER QUERY to MYSQL QUERY
NickName:user580950 Ask DateTime:2011-11-02T18:59:49

SQL SERVER QUERY to MYSQL QUERY

I am trying to convert this MSSQL QUERY to MYSQL

Query looks like this

select tu.FirstName+' '+tu.LastName as name,tg.Name as game_name,tg.Status,tg.UserId,tg.gameid from tblUsers tu    
inner join tblGame tg on  
tu.UserId=tg.UserId where tg.Name LIKE @Name + '%' 

the same query doesnt return any records when i run it on MYSQL, what is the issue ? It works good on SQL server

Copyright Notice:Content Author:「user580950」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/7979221/sql-server-query-to-mysql-query

Answers
Maxim Krizhanovsky 2011-11-02T11:06:37

SELECT CONCAT_WS(' ', tu.FirstName, tu.LastName) AS name, tg.Name AS game_name,tg.Status,tg.UserId,tg.gameid\nFROM tblUsers tu \nINNER JOIN tblGame tg ON tu.UserId=tg.UserId\nWHERE tg.Name LIKE CONCAT(tu.FirstName, ' ', tu.LastName, '%')\n\n\nNotes:\n\n\nit's case insensitive, I've used upper case just for readability\nI've intentionally used both concat and concat_ws to show them as options\n",


More about “SQL SERVER QUERY to MYSQL QUERY” related questions

How to Convert SQL Server Query to MySQL Query

I'm trying to convert this SQL Server query to MySQL query how can i do that? Fallowing is my SQL server query. I need to convert this query to execute in MySQL. EpfNO is the Primary key and IsVali...

Show Detail

SQL SERVER QUERY to MYSQL QUERY

I am trying to convert this MSSQL QUERY to MYSQL Query looks like this select tu.FirstName+' '+tu.LastName as name,tg.Name as game_name,tg.Status,tg.UserId,tg.gameid from tblUsers tu inner ...

Show Detail

convert mysql query to sql server query

I want to convert below mysql query to sql query.I want to use If condition in sql server SELECT foodName, IF( foodPrice>2000, 'Expensive', 'Cheap') as fpDesc, discountPercent FROM restaurant.f...

Show Detail

MySQL query to SQL Server query

I defined sql query and it runs with no problem on MySQL (I am using MySQL) , but when I am trying to execute it on client site (they uses SQL Server) I am getting "Error: Incorrect syntax near 'si...

Show Detail

SQL Server Query to MySQL query conversion

I am doing query conversion from SQL Server to MySQL. So can anyone suggest a website which provides the different keywords that will do the same operation in SQL Server and MySQL respectively? For

Show Detail

How to convert mysql query into SQL Server query?

How to covert mysql query into mssql query? SELECT name FROM user LIMIT 5, 10 I have known that mssql don't support 'limit'... But I have to use limit! How to covert mysql query into SQL Server...

Show Detail

Sql server Query in mysql

I have a query which work fine with sql server but error in mysql this is the error com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Incorrect parameter count in the call to native

Show Detail

Query in MySQL and SQL Server?

I have a problem to a help of every people: In Mysql, my query: select * from readquestion where readexerciseid= "+readexerciseid+" limit "+(start-1)+", "+count+"; I want t

Show Detail

Query an MS-SQL server from MySQL server

I work for a large organization that has an established and well populated MS-SQL server. However, I am not a Microsoft user, and my database of choice is MySQL. I am looking for a solution that will

Show Detail

Turn MySQL query to SQL Server

I have this query in MySQL: Select * From Customer Order By ID DESC Limit 1,1 How to use this query for SQL server ?

Show Detail