I’d like to put together only unique values in the concatenated string. My code is currently: This gives me the output I’d expect, but I would like to eliminate the duplicate values in the stuff/for xml path field. I’ve tried various combinations of distinct and group by in the stuff/xml sec…
How to get history of table structure change in SQL Server
I have a table in SQL Server 2012. The table has few columns. Now I need to check for which column and what is the DDL script has been executed on this table. Or if it is possible to get what is the …
Concat multiple rows with a delimiter in Hive
I need to concat string values row wise with ‘~’ as delimiter. I have the following data: I need to concat ‘Comment’ column for each ‘id’ in the ascending order of ‘row_id’ with ‘~’ as delimiter. Expected output is as below: GROUP_CONCAT is not an op…
How to Update table row using regex
I have a table with rows like this: and I want to update my rows to keep only normal data and delete data inside “()” I’m wondering if there is a way to use regex inside my SQL update statement to delete all data after ” (” Answer You must use 2 SUBSTRING_INDEX like this if there…
How to convert some queries from sql to sparql?
I am just learning Sparql and I have the following tables: Countries, European Country, City and Capital I would like to know how to make the following queries, because I didnt understand them… 1) Which country has the city “Paris” as capital. 2) Print all the European Countries 3) Print all…
Use UNIX_TIMESTAMP on update instead of timestamp
I want to add a column with a unix timestamp to see when the row was last altered. So far i could only figure out how to add a column with timestamp format. Is there any solution to use a unix timestamp – something like this: UPDATE: similar question As far as i understand this thread only shows how to
Select the latest message thread values from a table using sql
This is my table Id | ReceiverId | SenderId | Text ———–+—————+————–+———– 1 | 5 | 1 | text 2 | 5 | …
SQL database value to variable
So, I am kinda new to php and mysql, but I have found a login form and adapted it to my needs as I dont have the knowledge to make one my self yet. I added a firstname and surname column into the database and the register form adds the values into the database fine. Now I want to be
How does a recursive correlated expression speed up distinct queries?
I found this post about speeding up distinct queries: Super-fast DISTINCT using a recursive CTE: — 15ms CPU The recursive CTE is 100 times more efficient 🙂 This kind of speedup would be extremely valuable for my current project, but I am not sure in which cases this approach is beneficial. To be honest:…
How to update Sql table from excel directly?
I have an sql database and I am able to connect with excel spreadsheet. But when I update the table from excel directly it’s not updating the database and once I click refresh all the entered data is …