TLDR: I want to get a table with the previous two months in Teradata, based on CURRENT_DATE. Currently I can only get the previous month: Expected output is: Long version: I want something, that could be used in a bigger query like this, valid for every day of the year, without hardcoding the dates. The bigge…
Python – loop through same query with different variables, merge data frames
I have a query in SAS where I use a Macro variable to repeat a query to Teradata with a different variable. We have 5 databases, one for each state, where I run the same query, but use the variable to update the state, then mend all data sets. I’m looking for help in how I can do this in
How to find rows in SQL DB with a definite word length?
Good day, I’ve got a column with text in my table, but i need to export words 17 letters long only in it. I tried to use but my query newer completes. This is an example of text cell REIGHT CAR DUMP T.M. “HOWO”, COMMERCIAL NAME A7, MODEL TOTAL 4 PIECES, WITHOUT PACKING IDENTIFICATION NUMBER …
How to do sampling in sql query to get dataframe with pandas
Note my question is a bit different here: I am working with pandas on a dataset that has a lot of data (10M+): q = “SELECT COUNT(*) as total FROM “” df = pd.read_gbq(q, …
Query for similar phrases
Is there any way to match ‘United States of America’ with ‘United States’ in SQL? I have the country with the name ‘United States’ stored in the database. The query below should retrieve the item from the database with the name ‘United States’. Thank you! Answer…
How to find every genre from an artist in a music database in MYSQL?
So I’ve got a database with 4 tables: artist, genre, track and album. Track table points in a many to one way to Genre table, and so on with Track to Album, and Album to Artist. Suppose I want to find every genre that ‘John Coltrane’ plays, so I thought about saying But this just gives me i.…
How can I display my primary key as a column when using inner join?
select StaffNo, SName, BranchName from STAFF inner join BRANCH on staff.branchno = Branch.branchno; I am trying to display BranchNo in the results from the above query, whenever I add BranchNo after …
SAS SQL using a where condition with macro variable
I have a proc sql procedure in SAS where my where clause should be dynamic (the set of ID numbers will be updated in the future). I could do something as follows for a unique character condition: %…
Why can’t we use/refer to derived table in subquery
I wonder why can’t a subquery use a derived table as its derived table (Query2), even though it can access the attribute of the derived table (Query1)? Query1 select B.col1, col2 from dummy B where …
Express passing arrays into sql (express/mssql/react)
I am trying to upload two arrays into my sql database. This is what I have come up with.(this is my server.js using a endpoint from my client side) My express app.post(“/post-question-answers”, …