Skip to content

Postgres join and count multiple relational tables

I want to join the 2 tables to the first table and group by a vendor name. I have three tables listed below. Vendors Table VendorOrders Table OrdersIssues Table The expected output is to count how many orders belong to a vendor and how many issues belongs to a vendor order. I have the below code but it’…

Postgresql work with null rows after joins

For example, we have next query: select A.id, A.field > (case when A.cond1 then (case when B.field is null then 0 else B.field end) else (case when C.field is null then 0 else C.field end) end) …

postgres array of increments/decrements

I have a table like: +——+——+——-+ | Name | Date | Price | +——+——+——-+ | A | d1 | 5 | | A | d2 | 5.5 | | A | d3 | 5.75 | | A | d4 | 5.65 | | A | d5….

Insert .csv file to SQL Server using OpenRowSet

I have a .csv file, called File1 that I would like insert into my already existing table, called Table1 within SQL Server. The .csv file has the following structure and values: ID Location …

SQL select unique name based on max index

I have the following table -| id | name | index | number| answered| time | -|——-|————-|——–|——-|———|——————-| -| 043b | callline2 | 1 …