I’m trying to figure out how to prevent NULLs on return from a select and do not return anything (0 rows) for that query where I provide incorrect state value as select avg(lat) as lat, avg(lon) as …
Oracle SQL Rewrite so field does not return invalid indentifier
I am creating a view and you cannot create a view with a column outer-joined to a subquery, so I found another way to do it, but now I am having an issue with a field being out of scope. create table …
How do I get the latest records from every customer with a time delta
I want to get the most recent records for every customer and also accept/get records which are 1 hour older to the most recent record. I am currently getting the most recent records for every customer …
SQL case statement when duplicate rows
Goal: col: id needs to be unique, no duplicates Issue: when id_catelog1 is null, id_catelog2 kicks in but makes multiple rows since some of them have multiple id_catelog2. For the multiple ones, I …
Getting the data from SQL and inserting it inside the Java Textfield
I’ve been trying to get the data from the SQL and insert it inside the JTextfield. This code is in the button action, but when I clicked the button, there is nothing happening. Answer I redo my JFrame and rewrite this code. There is no problem with this code. I think it just override because I copied th…
Second greatests running value with SQL
I have a table such as: n value 1 1 2 4 3 4 4 6 5 4 6 8 I can easily find the running max of this value: SELECT *, max(value) over (order by n rows unbounded preceding) as mx FROM table n …
None-unique column index error using cur.fetch_pandas_all() to extract data from Snowflake
I’m pulling results from Snowflake using the code below. The SQL statement returns fine in Snowflake Web UI but when pulled in Python I get a ValueError: Found non-unique column index If this happened in my Pandas workflow, I would reset_index() but, as its happening at the point of the dataframe being …
Deleting record outputs else statement of else 3 times after deleting record in PHP and SQL
I am trying to delete a record in php mysql but my code jumps me to the else statement where I have “record not deleted” message printed out. Strangely it prints out 3 times. I am attempting to have it simply show an alert when the record is deleted to keep things simple. I know I am connected to …
SQL – get an AVG from a COUNT
how you doing? I’m trying to get the average from a count. The metric is a string, so I get an error. I’ve tried some ways, but I can’t. Thanks for your help This is the code This is what I’ve unsuccessfully tried AVG (newsletter) as percentage AVG (CAST (newsletter as INT64)) as perce…
HOW TO CHECK CONDITIONS FOR PREVIOUS MONTH
My table is like I am trying to get customer_ids where they didn’t do any transactions previous month and made transactions with at least 2 transaction_type at this_month.While doing this I am converting rundate to MM-YYYY format. What I’ve done for getting previous month and this month on MM-YYY …