Skip to content

Tag: sql

About “group function is not allowed here”

I have a table with job, salary and date columns. I am writing the following query in PL/SQL, but I am getting an error group function is not allowed here How can I solve this problem? Answer Your query makes no sense (to me, at least). What does that average salary represent? Whose average salary? Here&#8217…

presto sql filter part of the string java

I have a string in col1 select col1 from table “blah blah 123 blah iterate 866 loss blah blah” how to filter string between iterate and loss and just show sum of all such filtered numbers ? Answer You can use regexp_extract to extract the number within that string, convert the values to a numeric …

Categorize the total amounts

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…

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…

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 …