I want to select the max() value of the modified_at column in each of several tables: This works correctly as long as each of the tables has at least 1 row. The problem is that when just one of the tables has 0 rows, null is returned for all tables: What is a solution that returns the correct values for
Tag: sql
How to run a unique function to calculate and replace a null value in a database?
In the above database, I want to calculate the value for “A2” using the other 3 variables. The premise is that each column has a specific score with respect to each variable and the javascript would sum the answers in a row with a null blank in the A2 slot in this case. Answer You can implement th…
Limit MYSQL search results to dates greater than variable
I have a MYSQL table posts which contains a VARCHAR(25) column created that is filled with datetimes in the format XXXX-XX XX:XX:XX. I’m attempting to search by dates > now – 24 hours. When searching with just one posts.uuid I get the desired result, which lists all posts from that uuid that ar…
How to find whether the same customers who ordered this month also ordered the next month?
I have an orders table Now I want to find how many of the users ordered in 1st month also ordered in the next month. In this case, user_id’s 32,24,27 ordered in 7th month but only 24 and 32 ordered in the next month. I want the result to be like : I’m lost here. Can someone please help me
SQL – Pick first row satisfying a condition below every row satisfying another condition
Suppose I have this table, named Table I want this result: That is: If Col1 = A and Col2 = 1, take the corresponding row If Col1 = A and Col2 = 0, take the first row below it where Col2 = 1 I tried something like but it’s not quite what I was looking for. I couldn’t come up
c# How to dapperRow to strongly typed object displayed in grid view
I am sure i have not the best practice solution like the most of u guys could program, but im new in the business so pls give me a chance 😛 i created a table in my sqlite database and added a Employee to the Employee table. I Set the DataContext of my GridView to the returned List from my
“Operating system is not presently configured” error with Access ODBC
I get this error when I try to connect to Microsoft Access Database via Python. The code has been working all the time and only started popping the today. Can someone please guide me to why the problem may be occurring now? I tried doing this “Operating system is not presently configured” error wi…
MySQL: How to sum on joined queries (subqueries) with multiple conditions?
I have two tables: Table Y: indicates over what time period money is valid +———–+———+——+ | starttime | endtime | name | +———–+———+——+ | 1 | 2 | Mark | | …
How can I retrieve an updated script in the oracle database?
How can I retrieve an updated script in the oracle database? An incorrect script was run in the oracle database. I want to get this script back. how can I do that? The script is as follows. Answer If you haven’t COMMITted the data then use ROLLBACK. Otherwise, your solution could be as simple as running…
How to get row count based on other column groups
I need to count the number of dates with which the invoices are made to certain customers in each month Consider the table named Table1 I tried the folllowing code and the result was The result I need should count the column named branch based on column month, the desired result is Here rowcount is based on b…