In PostgreSQL I have a table (Table) that contains an id column (ID) and another column (Values) that contains an array of strings. I have a select query (SelectQuery) that gets me an ID that matches Table.ID, as well as an array of values (RemoveValues). I would like to now remove from the Values array, any …
Tag: sql
SQL query for customer and order- profit data
I am trying to write a query. I have 2 table in first table customer and 2018, 2019 order and profit data. In second table customer and 2020 0rder and profit data. I want to write a query that will return all customer and their order and profit in a different format. I have attached the screenshot of data and
Query assigning a null to a column if a dependent column is also null in sql
I have a table that contains dozens of athletes and the hours they spent at the gym everyday. My goal is to calculate their total hours in a month. They were supposed to go every day, and if they missed any day (null for that day), I want the entire total hours column for that athlete to display null, not
GROUP BY Subquery returns more than one row
I’m looking for a way to solve the following situation. I have a table that I need to return only one number for each “p.pays”, This query is supposed to list “nom from table Pays” where at least half of the “athlete” have are in the table “Resultat” but m…
How can I take USD Forex Buying and EUR Forex Buying Rates with date from TCMB, using SQL and XML?
I want to take USD and EUR Rates from TCMB page. Im using this first of all. Im using this for creating table. Im using this for parse XML file but I couldn’t parse correctly. I want to take only Date(as Tarih), DolarForexBuying,EuroForexBuying rates. And Im using this code for adding rates to my table.…
merging tables with different structures
I have two tables where I want to find the outer join based on a Ticker variable. In Table I, I have only one Ticker for each entity (fund), but in table II, I may have multiple records (multiple Ticker) for each “FundID”. The goal is to count the unique funds. I want to have table III, which is t…
Error “Column does not belong to referenced table.” in procedure with update clause
I work with IBExpert. I want to increase column STIP by IND percent in update clause in my stored procedure PR_INDEXSTIP. For example, if input parameter will be 0.25, I need to increase my field STIP by 25%. And I think that in set clause I should to write: STIP = 1.25*STIP. So, I have this code (don’t…
SQL Query: Aggregate multiple values with Case and count it
I have the following query and I want the output to show only the count of Active Members and Non-Active Members: The result I am getting is this: Where the two lines “Non Active” are of this 2 status (‘Unemployed’, ‘Housewife/Student’), I’would like to know how aggre…
How can I join two results
I have 3 tables purchase, air_transfers and sea_transfers. I have made the example code in db fiddle. My problem is on 6th paragraph where I don’t have any sea transfers, I get null as id and thats because I’m using id from sea transfers. What should I do to fix this? purchase table: air transfer …
SQL : String extraction from Path
Could you please help on how can I extract String1 , String 2 and String 3 to use these in my SQL queries .. Answer Please try the following solution. It is based on tokenization via XML/XQuery. After that it is very easy to pick up any token based on its position. SQL Output