Skip to content

Tag: postgresql

Return only one row in subquery

I have the following query that I’m executing to show these records on a Laravel view. I’m having issues with this line Because there are a lot of cities with the same name in my database, so it’s throwing an error, (probably the same with states but the error is being thrown at cities in th…

how can i get the sum of two colums realtime

i have the following I want to have something like that select *, a+b as mes from maths; but to have a column sum and evrytime the columns a and b get update calculate the new sum in columns sum i try this and i get the following error Answer The syntax for generated column in PostgreSQL is: Demo: https://dbf…

Simple Postgres query returning no result

I have two tables: and I have indexes on id in both tables, and an index on website_id and product_id on the adjustments table. This query returns data but it takes some 5 seconds with some 1k products and a couple hundred in adjustments: This other query however returns no results when there’s nothing …