Skip to content

Pulling out monthly daypart data

I’m dealing with sales data that looks like this Date Time Net Amount Store No Item Category Code 2021-03-21 00:00:00.000 1754-01-01 08:01:14.627 100 001 FOOD 2021-01-31 00:00:00.000 1754-01-01 15:42:21.670 120 002 FOOD 2021-04-24 00:00:00.000 1754-01-01 17:35:30.070 160 002 FOOD 2021-03-14 00:00:00.000…

Field value counts with aggregate conditions

Suppose I have the following applicant data for jobs in a company: The budget is 40000 and the preference is to hire senior managers. What PostgreSQL constructs do I use to get the following result as far as the number of hires are concerned. Any directions would be appreciated. Here is a starting sqlfiddle: …

SQL query not returning all possible rows

I am writing a simple SQL query to get the latest records for every customerid. My SQL query – Sample data: customerid device_count date_time A 3573 2021-07-26 02:15:09-05:00 A 4 2021-07-26 02:15:13-05:00 A 16988 2021-07-26 02:15:13-05:00 A 20696 2021-07-26 02:15:13-05:00 A 24655 2021-07-26 02:15:13-05:…

SQL Subquery as expression

I have the following two tables: I want to be able to return all the claims that are a specific FormType and AdjustmentVersion. Given the following query: How do I correct the syntax to match the AdjustmentVersion on the given integers and the subquery at the same time? Currently, I am getting error ‘Su…

Can * be used for partial topics in AWS’ IoT Rule syntax?

Is this allowed as AWS’ IoT Rule syntax?: Answer No, you cannot use a * to achieve this, since you must pass a valid topic filter. According to the documentation you are able to use a + sign to achieve this effect. Quoted from the documentation linked above: A subscription to sensor/+/room1 receives mes…

Find Latest Child Record (With Conditions) Per Parent Record

I have 2 tables with a parent/child hierarchy and am trying to pull the ID for the latest child record for each parent record, but also with conditions applied on the child record that is being pulled. Here’s what my tables look like: Now, let’s say I want to pull ID of latest QuizAttempt for each…

Power BI Report Builder Indicator Formula

I am adding in an indicator to a PBI Report Builder Report. The indicator is based off multiple fields from the dataset so I need to use a formula, to create the three up/down/side arrows. Previously in Crystal Reports this could be implemented using a series of IF statements as follows. The below example is …