Aside from doing a direct match on something like a whitespace normalized hash of a query, what might be a useful (but-not-necessarily-perfect) way to handle query cache in a partial manner? For example, let’s take the following basic case: This potentially could be used as a ‘base-cache’ up…
Snowflake – Issues with table filtering on dates
I’ve created a query that produces a set of dates based on start and end date. Everything works fine, but when I try to filter the underlying table to only produce the records between my range, it still results with all the underlying dates. I’ve tried using between, changing the variables to date…
Adding custom value to SELECT
I have this query: I want to use the record_dt of the second query as a replacement of the record_dt in the first query. I want to do that by linking the values on the part_id since they both have it. First query is giving a list of record_id that has part_id, the second query is taking the latest record_dt
How can I replace this correlated subquery within a function call?
Given the following tables buckets points And the following query Output How can I remove the correlated sub-query to improve the performance? Currently ~280,000 points * ~650 buckets = ~180,000,000 loops = very slow! Basically I want to remove the correlated sub-query and apply the width_bucket function only…
sql – Deletion in closure table with multiple same paths
I have the following hierarchical structure: Here is the closure table I’ve come up with: I want to remove the link between B and D, and therefore I want to delete the link between A and D (the one of depth 2). The problem is that I don’t want to delete the link between A and D of depth 3
How can I delete record based on date?
I have a set of data with DateTime type in SQL. I want to delete whatever data belong to a specific date for ex: 2021-11-02 21:07:52.663. if I have value like above I want to delete records using just date. 2021-11-02. Answer This will compare the date part of your datetime to the desired date:
Querying for Unique Values When The Value Exists on Multiple Rows
Thank you for reading! I want to find any value (“Name”), but I don’t want that value if it exists on the same row as a “Type” that equals “Z”. As an example, in the table below, I want all Sam and Joe records, but I do not want any Bob records, because one of the row…
Use having on SQL Query
I’m use the next query to get the average of memory used, but only need get data when average is more than x value And show me the next error Found 1 problemnline 1:152: Cannot use HAVING filter on non-aggregate [@timestamp]; use WHERE instead” And when use WHERE clause, like this Show the next er…
How can I convert a date that’s in “yyyy-mm/dd” to “yyyy-mm-dd”
I have a column that’s called appt_date (varchar(50)) that’s in the format of YYYY-MM/DD and I want to convert it to YYYY-MM-DD I’ve tried several replace, convert, cast functions and solutions found on here but I still end up with the same result. I greatly appreciate the help in advance. A…
Query to sum the top “n” records
I would like to sum the forecast qty column for only the first “n” date records. For example for each item number the earliest(or first) three date records Current Query: Table Desired Result Answer Assign a row number to each record, partitioning by Item (this will start a new row counter for eac…