This is my very first Stackoverflow post, so I apologize if I am not formatting my question correctly. I’m pounding my head against the wall with what I’m sure is a simple problem. I have a table with …
Select two duplicate records if it has 3 duplicate records
Is there a way to get only two duplicate records in SQL Server if it has three duplicate records? Example I have records ’10/13/2020′, ’10/13/2020, ’10/13/2020′. as you can see, it has 3 duplicate …
Using rank to enumerate the session
Hi can anyone help me for this. What im trying to do is to rank my session id but it seems not to work as it returns me just “1”. The third row should be 2, the row 5 should have 2 for rank and the row 6 should have 3 for rank and so on. I try to enumerate
How do I select just mutual rows in SQL?
I have a table with a source_id and destination_id and a message and I want to group messages together. There can only be one message between a given source_id and destination_id, but I only want rows that have a mutual response for a given ID (say id 1). In the following examples, I want rows #1, #2, #4 and …
How to cascade on delete in a foreign key of a mysql table correctly?
I have three tables with foreign keys which should cascade on delete nevertheless when I run this only the mapping in Tagmap and nothing happens in Excerpt nor Tag. What am I doing wrong? Answer This is not how foreign keys work. You delete from the parent table (here, tag, or excerpt), and then children reco…
Comparing each colum in a row to every row in the database sql
I am building a bot that matches users based on a score they get, this score is taken from calculations done to data in a database on the request of the user. I have only 1 table in that database and a few columns (user,age,genre,language,format,…etc). What I want to do is, once the user clicks “f…
SQL Flag Rows Occurring 2 Hours After Previous Flag
I have some messy RFID data due to over sensitive antenna’s. There is a physical process that tracks an RFID tag moving through different stations in a cycle. An item with an RFID tag can move through the cycle more than one time a day, but it is highly unlikely that it could start the cycle within a tw…
Column must appear in group by or aggregate function in nested query
I have the following table. I am trying to query the following: For each year that appears in the Fights table, find the city that held the most fights. For example, if in year 1992, Jersey held more fights than any other city did, you should print out (1992, Jersey) Here’s what I have so far but I keep…
Power BI – DAX List.Select syntax to return specific records
I unfortunately discovered today that I cannot use SQL to return a subset of records when Power BI references a SQL Server DB as a data source. I’m trying to do something similar to a SQL where clause using “IN” for example I’ve tried this (and several other variations) in DAX but get …
SQL: Remove part of string that is in another column of the table using REGEXP_REPLACE
I have a column that looks like so, but with more rows: Now, I am trying to remove the cat name from the message on each row in the table, so that I can see what the messages sent to each cat are, and which cats got the same message (i.e. this way I would be able to see that