I have an array. Can I send the values in an array with one query and get a separate response for all arrays …? $regions: array; $result is laravel query result [‘index’] is index from SQL $…
Too many open connections on sending Email
I’m trying to send email to every users from DB. I use a loop to get the message text per user as I loop need to call the send_email. But I got an error saying: ORA-30678: too many open connections …
How to make LAG() ignore NULLS in SQL Server?
Does anyone know how to replace nulls in a column with a string until it hits a new string then that string replaces all null values below it? I have a column that looks like this Original Column: …
Count number of items per ID
I have a table as below INPUT ID ITEM 1 Apple 1 Banana 1 Orange 2 Pear 3 Apple 3 Pear I want to count the items per id, such as OUTPUT ID ITEM ITEMS_PER_ID 1 …
Query returned values in SQL
I would like to write an SQL query which uses results from previous one. For example – I have a table Orders with fields: order_id, date and value. I need to get all dates from column date where …
Join Generated Date Sequence
Currently I’m trying to join a date table to a ledger table so I can fill the gaps of the ledger table whenever there are no transactions in certain instances (e.g. there are transactions on March 1st …
How to select certain number of rows from large query result set in Teradata sql
I am new to Teradata sql and I have a query that selects over one million rows. I want to write teradata sql to select the first 500,000 rows, then the next 500,000 rows and then the last 100,000 + rows in my data set. For the first set I know I can use SELECT * FROM QRY1 ORDER BY
How to use VBA variable in SQL string? Enter Parameter Value error
I get a popup box asking for the parameter value for the value of CXIid Enter Parameter Value for CXI00012. I tried ‘ ” & CXIid & ” ‘ but then I get a result of 0 rows being updated. However when I put a value in the where clause or into the Enter Parameter Value prompt I get t…
Finding Gaps in Timestamps for Multiple Users in PostgreSQL
I am working with a dataset containing Check-In and Check-Out times for multiple office rooms over the last 5 years. One of the projects I was asked to work on was calculating the amount of time each …
What is the best way in SQL to combine sequential events based on matching end time to start time?
That database I work in records events based on a part ID and the times in which it is active. The issue I came across is these events are truncated to fit within a single day. If the active time for a part carries over to the next day, the event will be split by the number of days it