Suppose I have 100 columns and I want to search for something but I don’t know which column to search. How can I write a loop that: SELECT * FROM table WHERE col1 = ‘x’ OR col2 =’x’ OR col3 = ‘x’ …
DB2 – Using Running totals to calculate Month To Date Sales
I’m calculating the Month to date sales using DB2 code to compare July 2019 vs July 2018 totals. It needs to be rolling to compare the current month of data to the same month last year, otherwise I …
sql left email till @ symbol
i have a column called Email in my sql database so i need to left my column to get whats before the @ symbol
SQL Inner Join returns duplicates
I have the following 2 tables: tab1 with 37146 rows week_ref with 730 rows All I want to do is join those tables on year and week so that the first week day and last week day will display next to …
MSACCESS returning NULL values where textbox = “blank”
I have a search query that returns values from textboxes. I want to add the functionality to return all rows where Comments is null or empty. I have tried editing the SQL to accept “blank” in the …
SQL for storing numbers from cold to hot for specific range?
We have a table that looks list this: date, val1, val2, val3, val4, val5 for a given row, val1 -val5 are unique and between 1 and 37 Using T-SQL, How can I list numbers 1 -37 by cold to hot with their frequency for a given date range? [![enter image description here][1]][1] Sample Output (NOT ACTUAL): Numbers by frequency descending:
SQL : Choose three stock tickers which have complete data between 2012 and 2017 in the Quandl Wiki data set
I have a custom_calendar table like this: [1] https://imgur.com/YLUix5y “custom calendar image” And I have a stocks market table ( v_eod_quotes_2012_2017 ) which looks like this: [2] https://imgur.com/a/Ff7Gkw1 “v_eod_quotes_2012_2017” As I mention in the question, I need to find out which three stock market symbols has complete data i.e data for every day in between 2012 and 2017. I have
Grouping a column in oracle
I have three columns within my table: Amount, OrderNumber, Customerid For each customerid there will be ordernumber and amount. Now i need to display customerid,Ordernumber and Amount(total Amount- …
SQL monthly rolling sum
I am trying to calculate monthly balances of bank accounts from the following postgresql table, containing transactions: # d transactions View “public.transactions” Column | …
INSERT ALL error ORA-02291 integrity constraint but PK is referenced
I’m creating a basic sales and inventory DB for a class. I’ve successfully created the tables necessary with where I want my PK and FK’s to be. The issue I’m running into now is when I try to …