Skip to content

Tag: subquery

Postgres: Count multiple events for distinct dates

People of Stack Overflow! Thanks for taking the time to read this question. What I am trying to accomplish is to pivot some data all from just one table. The original table has multiple datetime entries of specific events (e.g. when the customer was added add_time and when the customer was lost lost_time). Th…

SQL subquery in SELECT clause

I’m trying to find admin activity within the last 30 days. The accounts table stores the user data (username, password, etc.) At the end of each day, if a user had logged in, it will create a new entry in the player_history table with their updated data. This is so we can track progress over time. accou…

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, …

Using subquery with update SQL

I have Table 1 : EMP as below Table 2: EMP1 ID is the Key and is common in both the files. I want an Update SQL to update the amount field of Table 1 using Amount field of table 2, which gives the result as below. Result: Answer One method is a correlated subquery: You can check if the