Skip to content

Using distinct with stuff/for xml path(”)

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…

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

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