I have a query that gave me a list of store names and its respective amounts. However I would like to sum and categorize the amounts like this: Store Name | $0-$50 | $50 – $100 | $100 – $500 | $500+ Based on the following screenshot: Here is my condition: Here is my basic query for the above snaps…
Is there an elegant way to aggregate data by groups based on elements of an array in SQL?
I’m looking for a way to aggregate data by groups that are based on elements in an array. I’m working with product and sales data in a BigQuery warehouse, and want to measure the sales of collections of products, where each product may be in more than one collection. This is probably best explaine…
How can I extract all text between single full stops (i.e. ignore `…`) with a re2 regex?
How can I extract all text between single full stops (i.e. ignore …) with a re2 regex? I am using the REGEXP_EXTRACT_ALL function in BigQuery which uses https://github.com/google/re2/wiki/Syntax. From the following example: This is… a.. sentence. It is just an example. I would like the query to ex…
List count for last 12 months broken down by month
I have a query that can get a total active count of products until a specified date @POINT Output for @POINT “01/01/2021” is From a table like How would I remake this query so that I can have a list of points (last 12 months) like in one query? I don’t want to create a separate table of date…
How to create a SQL function to parse multiple xml formatted strings?
I am trying to parse a price from a price column in SQL. I have already create a function that will parse the price but it only works if “all” price strings are the same on all items. I realize now that I need a more robust function that can parse out multiple price configuration. Here is my simpl…
preparedstatement stopped working after inserting into database
I wanted to insert into table called accounts from user input but this is the error. It used to work but suddenly i dont know what happened and it doesnt work anymore Error code: Exception in thread &…
Select one existing row order by where clause
I have a table like that: ID | lang ——— 1 | ru 2 | en I want to select 1 top existing row from my where clause. Not ordering by id or by lang, but ordering by my where clause. where lang in (‘…
SQL data types for AnyLogic
I am saving the output of my AnyLogic model into an SQL server database. For non-AnyLogic aficionados, AnyLogic is based on Java. However, I am not sure what data types I need to specify for my columns in the database. So far I am using these: double in AnyLogic : float in SQL string in AnyLogic : varchar in …
SQL – sum column for every date
This seemed like a very easy thing to do but I got stuck. I have a query like this: select op.date, count(p.numberofoutstanding) from people p left join outstandingpunches op on p.fullname = op….
SQL get value from XML in tag, by tag value
I have the following XML: TEST1 D028 …