Skip to content

Tag: postgresql

Accessing PostgreSQL Fields via Indexing

Is there a way in PostgreSQL to access fields without explicitly providing the column name? For example, instead of the statement: there’s a (possible) alternative of: Answer There is no such syntax in Postgres’ SQL. You could always resort to having code that dynamically constructs the query for …

sql table comparisons – postgres

I have two tables with some columns being the same: TABLE A TABLE B I’d like to return the following: How do I check what rows from table B are in table A and also return Col4 (from table B) where they match in the query. I was using EXCEPT which worked great but now I need to have the

Querying JSONB array value for sub values?

I have a JSONB Object: It is stored in a jsonb column of a table So i was trying to get a count by name of devices which have interfaces that are not ‘up’. Group By is used for developing counts by naame, but i am having issues querying the json list for values. MY first Attempt was: Some surround…

Select query to show missing values per day as 0

I have one table with product id’s and another with daily data for these products. When there is no data I want to return 0 instead of no value at all. I tried using a left join but this doesn’t give the resultset I want since the table I can join on has product id’s only, not per day. I