i have a table like this: and i want to copy the values from the first column to the non existent column that is ‘qty’ how do i do that if they have different data type? what i originally wanted is when the 1st column’s value is 0, then the column qty should be blank or empty, not [null], i
How does a Laravel model get a “required” data? New column, adding another column’s data
Still new to laravel, learning how the $request interacts with create. here is my form for two of my variables for context: controller: model: my title and category_description is inserting fine with an auto incremented id column. What I am trying to do is just to add 2 columns: category_id and category_descr…
oracle sql Sort dated transactions by order of transaction
I have been working on this for a few weeks and I know there’s a way like using ROW_NUMBER(), but I’m just not too familiar with it, Or maybe there’s a better way…. shows this: It needs to show this: As you can see, there’s 2 delete dates for SKU 555454, and it has to show the la…
Sum of two counts from one table with additional data from another table
I have two tables as follows: I want to get the sum of two counts, which are the number of true values in col_a and number of true values in col_b. I want to group that data by user_id. I also want to join Table B and get the name of each user. The result would look like this: So
SQLite update data from one table to another
I’m trying to insert some data from one SQLite database to another. I have 2 tables called “members” and “attendance.” What’s supposed to happen is, everytime a new member is added into the member table (or removed), the name and ID of the specific member should also be add…
Postgres: Count multiple events for distinct dates
People of Stack Overflow! Thanks for taking the time to read this question. What I am trying to accomplish is to pivot some data all from just one table. The original table has multiple datetime entries of specific events (e.g. when the customer was added add_time and when the customer was lost lost_time). Th…
Aggregate function MAX giving unexpected output when used inside a HAVING clause
The Table Id Salary 1 100 2 200 3 300 I want to find out all the salaries lesser the highest salary. For doing so, i have come up with the following query- Which yields the output- {“headers”: [“salary”], “values”: [[100]]} But my expected output here is {“headersR…
How to iterate rows with known start position and mixed column ordering, exactly as if walking the corresponding index?
I have a given, unmodifiable table design which resembles: I simply want to iterate rows from this table in the order c1 asc, c2 desc, starting at a known position, e.g., (‘foo’, 5). The query must be efficient, i.e. the query planner must be able to take advantage of the unique index and do an in…
SQL Server 2014 slow remote insert
I have several linked servers and I want insert a value into each of those linked servers. On first try executing, I’ve waited too long for the INSERT using CURSOR. It’s done for about 17 hours. But I’m curious for those INSERT queries, and I checked a single line of my INSERT query using Di…
Query Multiplies The Result When Selecting For One Value
Hello, I want to show Product, Sub Materials,Alternatives, Orders and Dates. Product has 5 sub materials and 8 orders in different dates. The problem I am facing is that Sub Materials multiplies 8 …