Skip to content
Advertisement

Tag: postgresql

SQL how to select distinct several columns

lets say there are several columns (c1, c2, c3, c4) It’s okay for each column to be appeared several times, but I want to select all the columns with several columns distinct. I want SELECT c1, DISTINCT(c2, c3), c4 something like this but it doesnt work, and GROUP BY doesnt work as well. somebody help me please Answer You simply

postgres column allow space to column while making alias name

python code to make query from postgres table error: I wants to add space to alias name of column thats why i have written my code like this. Plese check how can i fix it. Answer Postgres follows the SQL standard and uses double quotes, not backticks, to escape database object names (such as column or table names). Use this

When do Postgres transactions fail?

I was wondering at what point a transaction actually fails in Postgres. By this I mean stop working, and return an error. Is it after the first failed query? Does it try all queries and then return failure? Hopefully it fails fast on first failed query, but I don’t know for sure. For instance, if I have a transaction with

How to make a join with the same table to insert the maximum column value?

I have a table that keeps activity records, containing the date of registration and other information about the activity performed. I would like to make a query that would return one more column in the table, containing the maximum record date. I don’t think it’s too complicated, but my knowledge is limited on the subject. Would a join between tables

Advertisement