Click here to Skip to main content
15,889,527 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have Make Query in Sql server 2008
I have to convert this Query in phpMyAdmin Query.

But I dont know phpMyAdmin Query.
So please help me how to do this...

my Query is as below and its execute successfully in Sql... thanks..

What I have tried:

SQL
Select top(10) a.user_id, UserMaster.UserName, CntuserID as NoOfMutualFriends
From 
(
Select COUNT(user_id) CntuserID, user_id
From FriendMaster
Where user_id != 1
Group by user_id
) a
Left Join FriendMaster on FriendMaster.friend_user_id = a.user_id and FriendMaster.user_id=1
Left Join UserMaster on UserMaster.userID = a.user_id
Where isnull(FriendMaster.Friend_Id,0)=0
Order By CntuserID desc
Posted
Updated 28-Mar-20 2:08am
v2

 
Share this answer
 
Comments
Member 9720862 28-Mar-20 5:05am    
Please Give me Query by changing in it..Because it is urgent for me...thanks
Richard MacCutchan 28-Mar-20 5:45am    
Sorry, we are not here to do your work for you.
Attempting to run this against MySql should show you what syntax is incorrect; I see three lines that are not part of ANSI-SQL and it is up to you to find out what needs to be done.

TOP(10) most likely can be replaced with LIMIT.
MySQL :: MySQL 8.0 Reference Manual :: 8.2.1.19 LIMIT Query Optimization[^]

The NOT EQUALS comparison is different in SQL than in programming languages. Microsoft added in the ability to use != just as an added feature. They do support the ANSI standard for this as well.
SQL Comparison Operators (Equal, Not Equal, Less than, Grater than) - Tutlane[^]

The last item I see is the IsNull function which does not have a direct replacement. What you should look at is the Coalesce expression, which will work in both SQL Server and MySQL. It is a more complicated operator under the hood but is preferable once you understand the nuances.
5 Differences between COALESCE and ISNULL in SQL Server[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900