I have a table with a list of invoices with there statuses and reported date, let’s say each date we have new report could change the invoice status from PENDING to PAID. I want subquery the first date an invoice was paid for each invoice. The table looks like this: invoice_id report_date status A1 08-2…
How to remove duplicates in CTE from VARIABLES and TEMPORARY TABLE
I was looking for this solution in internet and none of them worked properly. I decided to create variables, then accommodates it in the user defined function: It works properly, because for example I am able to return the top 10 Customer in the Furniture Category in 2011 and 2012 Then, I would like to have a…
MySQL error #1064 on create table with DOUBLE column
I’m struggling to code this table as it’s giving me a #1064 error, and this corresponds to a few potential issues. If someone could point out where I’ve made a mistake that would be great. Here is an …
How to iterate thru a json object in bigQuery using json functions
I have sample data in below way: {“_id”: {“$oid”: “60c1c3660a7b446da70f7b5f”}, “type”: “AppInstalled”, “created”: “2021-06-01T11:04:55….
field subtraction sql server
If I would like to subtract the fields from each other, i.e. in A there are 11 fields described as ‘Faktura zakupu’ and in B there are 5 fields described as ‘Faktura zakupu’. I would like to get a …
Avoiding computed columns code duplication in SQL Server SELECT statement
I am trying to build a SELECT query which I will eventually turn into a view, once finished, where I am selecting a bunch of columns from a Table and then have a series of CASE statements to populate a calculated column. However, I am a novice with SQL and so not sure the best way to go about this.
Geopandas to_sql shows geometry column as text in mysql
I am attempting to take multipolygon data from a geojson, read it into a dataframe, and then create a table in mysql containing the data. What’s weird to me is that checking the dtype at the end of the script will show the geometry column correctly as geometry. However, checking the mysql db this column…
Compering number to a current month in MS Access
I have a data table that looks like this: Id Month Number e1 9 2 e2 10 3 e3 10 1 e4 9 3 The month column is an integer. I want to get a sum of number both for October and September, but by using a reference to a current month and last month, as if the data is
QUALIFY equivalent in HIVE / SPARK SQL
I am trying to convert a Teradata SQL query into HIVE/Spark SQL equivalent. Is there any substitute for qualify along with count Answer Got it 🙂
MySQL remove zeros from decimal part if the number is whole
I have a sales table with price column as decimal(8, 2) and I’m running the query below to get the total price It’s working perfectly but my results are usually intergers so I end up with trailing zeros all the time. It’d be nice to just return the whole number if there is no decimal part An…