Skip to content

Tag: mysql

MySQL-condition on partition size

table1 has 3 columns in my database: id, category, timestamp. I need to query the newest 3 rows from each category: now I need to add one more condition: select only from the partitions which have at least 3 rows. how to add this condition? Answer here is another way:

How to prevent duplicate entry key when update

Problem explain I won’t update the last primary key of the 3 primary key concatenate. But the problem is sometimes the first and second primary key was the same for multiple records. And in this case, when I set my new value I have a duplicate entry key even I use sub-request to avoid that problem. Some…

How to return T2 name based on data from T1?

T1 game T2 heroes T1 IDC = ID from T2 I need to return all heroes that have anything except null in POWER or in HP with LTIME != -1 Query should return ID and NAME from T2 for that heroes. In this example query should return: 236 MAX I tried this: Answer Your WHERE condition in the subquery is

How can i make this Complex query for SQL database

I have a database that looks like this: Player (UserId, Mail, Password, Username, LastLogin) Leaderboard (UserId*, Level, Kills, Deaths) Match (MatchId, HostId*, ServerIp, StartTime, Team1Points, Team2Points) MatchStats (UserId*, MatchId*, Kills, Deaths) Weapons (IdWeapon, Name, Damage, FireRate, ReloadTime, …

how can I join multiple columns on two table in sql

I have two table like below how can I get all the information in table test_info and the name of the buyer AND the name of seller from the test_user table in the same statement? would just give me a seller or buyer but i would like to get the result for both Answer You must join 2 copies of