/////This question was deleted
SQL: Joining tables and dividing each cell by match cell in another table?
Here is my population dataset detailing the population of each state through 2010 – 2019: Here is my consumer complaints dataset which has date received and state: I already have the complaints for each state per year: I know I need to join compltsbypear and uspop on state and divide 2011(from complaint…
Conditional removing duplicate records
I’m storing some realtime data in SQLite. Now, I want to remove duplicate records to reduce data and enlarge its timeframe to 20 seconds by SQL commands. Sample data: id t col1 col2 –…
Getting data from three tables in postgresql
I’m new to postgresql. I have three tables Table1: teacher Table2: school_location Table3: teachers_school_location I want to write a query to get data from these three tables like this: (output in json by calling an API) When user select tid = 1, I want output like this When user select tid = 2, I want…
SQL- Invalid query because of aggregate function with simple calculations for each date and ID
I very new to SQL (less than 100Hrs). Problem case is as mentioned below. Every time I try a query either get incorrect output or error that “not contained in either an aggregate function or the GROUP BY clause” Have tried searching similar questions or example but no results. I am lost now. Pleas…
SQL Between Dates as an Object [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 1 year ago. Improve this question I’m trying to get only the dates between 2018 and 2020 but still get 2017… not su…
TSQL – how can I sum values except absolutes
I would like to sum values in my table, except the ones that are absolute (field absolute, value = 1). If that’s the case, the summing should reset. Example: Regular SUM() would return (4+7+3=) 14. But in this example it should reset at value 7, which makes a sum of (7+3=) 10. How can I make this work? …
Sql string with OLEDB gives error 1004 in VBA
I would like to import a text file into excel filtering just what I want through a VBA macro. When I use LIKE operator in the sql string I get the error 1004. I have tried both * and % as wildcard and ALike instead of Like but there is no difference. test_7.txt and the macro is: Answer SQL statements
Unexpected token when creating a string expression?
I have the following code: There is an error here ‘{cardId And it tells me Invalid Expression term ” Answer You need to be aware that this kind of string concatenation is avoided and it is open to SQL Injection attack, you should always use parameterized queries to avoid SQL Injection and also to …
Retrieve data from two different rows in a single SQL query?
I’ve a table with the following data and I need to find the number of minutes between two jobs (Say A and C). The following query works but wondering, if there is a simpler way to achieve the same. Goal is to achieve, the difference between start time and end time of two jobs. Answer I can interpret you…