Skip to content

select sum where condition is true and count > 3

I have two tables. FootballPlayers with columns Id_footballplayer, Last_Name, Fisrt_Name, Age Transfers with columns Id_transfer, Name_club, price, date, acceptance (yes or no), code_footballplayer How can I write a SQL query to select the last names of the players and the sum of the successful transfers carr…

SQLDateTime OverFlow with Correct DateTime Format

below is my code snippet where I insert a DateTime value to SQL database and encountered the following error: System.Data.SqlTypes.SqlTypeException: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM. May I know if there is a format to be used? when converting the value of r…

SQL Get Parent when child is column is 0

I have two tables below. Data: Using joins I have got the information from both the tables which have needed, but in a new case I need to extract the Address like if the IsNetwork = 0 then Address should of it’s the parent. Following is the query of join This is the output of that query: I want the

Retrieve the first occurrence of a record by ID in SQL

I am trying to import some data into Excel from a SQL server, but I am having some issues. It’s my first time writing a query, although I am able to get the entire dataset, I have realized that the data is full of duplicates. I want to get rid of duplicates in Excel and only keep Unique records. I