DB Fiddle Expected Result My database consists of two tables returned and customers. In the customers table you can find the date of the first_order per customer. In the returned table you can find each return a customer has done so far. Now, I want to create a list and count all returned_dates which are in t…
oracle data base error ORA-00920 invalid relational operator
This is my code after check syntax this error appear ORA-00920 invalid relational operator What problem on this code? Answer Unless you have a function called region that accepts three string arguments, this code does not make sense: I assume that you are missing the in:
Timestamps and addition of weeks
My query requires me to find the number of people positive and their infectious periods which is plus and minus 2 weeks. In my query below I keep getting null in my 2 weeks Timestamp What is wrong with my equation and why won’t it add the 2 weeks in the next column? In DB browser this is the format
PostgreSQL – using group by sum as input to function for creating additional column in a view
I am new to PostgreSQL and this might not really be the best way to achieve my result, but here is what i am trying. I have a table called meteo and another called areas. meteo has values of measured …
SQL – find usercode based on latest timestamp
I have a table that look like this: I would like to make a query that creates another table called “LastUser” which shows the USER that has the last TIME. In the example above that would be …
How to return zero instead of null from a subquery when a condition is not met
I have the following data, Id Value Tag 1 200 C 1 300 D 1 100 D 2 300 D 2 100 D I want to sum up values of tags and deduct sum of D’s from sum of C’s. The below works fine if both …
MS-Access: Calculate Stock From 3 Tables
I was reading this post from StackOverFlow to adjust query to calculate stock from 3 tables. I have 3 tables tblItems, tblPurchase and tblSales. tblItems contains items information like below. Screenshots of my tables tblItems: tblPurchase: tblSales: And my expected result like below In query result items det…
Update table with using NEWID() function
In general, I would update a table randomly like the following scripts. However, I get some issue. It would update more/less then 2 rows. I try execute the following scripts many times for debug. The results are not always only two records. If I remove the order by newid(), the number of output result will be…
How do I find the 4th record in SQL/ SAS PROC SQL?
Initially I tried including a sample SAS Table here but I can’t get the script to line break where it should – Appreciate if you can let me know how to manually insert the line break when typing in the text editor, thanks My question: For SAS PROC SQL – How can I return the 4th highest recor…
Finding Similar People’s Names from Database
I have a table in MySql with names in it. I am trying to, given an input name, find all similar names in the table. I’ve heard a lot about Levenshtien/Damerau–Levenshtein distance, but it doesn’t seem like it would work well for this, I’ll explain my reasoning later. To elaborate: User input…