I’m trying to create a SELECT statement where the values under “category” and “category2” column will become actual columns and show the corresponding “url” and “url2” under them. Basically I have …
Filtering out duplicates yet showing non-duplicate rows from another column in one row
I have a table with multiple duplicate values. What I’d like to do is use some sort of SELECT query that will filter the duplicates by name and yet keep all the appropriate values from the “expertise”…
How to join 3 tables and get the field with 2 different conditions?
I have 3 tables: Students, Courses (important field Points), StudentCourses (important field Grade). The exam is passed if Grade is greater than or equal to 70, so student will receive Points. If Grade is less than 70, student will not receive Points. Student is graduated if sum of his credits is greater than…
traverse to previous rows from current row in a table
I need to traverse to previous 10 rows from current row and check if all rows has codealert_hour . If all rows has alerts then display prev row alert else display null. image shows sample data. …
T-SQL query to show only differences between rows
I have a query that outputs the following dataset: I need to find a way to find instance where the unitid column and the stat column do not match. An example would be if unitid = 2, CleanCode = 10 …
How to secure save user login for long term access
I create a PHP/MySQL application that will be used to log in to the user with a username and password, but I need the user login to the system to survive even turning off the browser or restarting the …
SQL: Select the Running Total of Column C for pairwise combinations of two other columns A and B
I’m trying to query a table and calculate the running sum of a column’s values for pairwise combinations of two other columns. Specifically, given the following table: CREATE TABLE test ( bucket int(…
How to add next and subtract preceding row in SQL Server based on condition
I am trying to calculate the cumulative sum based on TranslationType column in SQL Server. Sample data: Id TransactionType Value ————————- 1 Receipt 10 2 Issue …
duplicate elimination with time
For my Smart home Stuff I create a Database, but I make a mistake during programming: the application posting stuff into the Database twice. I want to delete all rows, which contain duplicates. With …
Get Data from a single table to an empty table
I am quite new to SQL. I couldn’t find solution and I want your expertise here. I have one table “boxes” and contains the color and type and condition. I want to get the number of types per color …