How to read XML repeated nodes in SQL Server

I am using the following code to read OrderId but it is showing only first DECLARE @InputXMLHandle int Declare @RequestXml xml = ‘ …

How to update some rows in database table while processing data from that same table?

I have to write an update statement to update bunch of values in database table. First a bit of an intro. Our client is from industry of transport and logistics. They provide a service of transport (…

MySQL sort by 4 fields date and time

I have a table where there are 2 date columns and 2 time columns (arrival date, arrival time, departure date, departure time) I want to combine the 2 date fields in one and then sort by date, arrival …

How to use a function in select along with all the records in Sequalize?

Here is a Sequalize query below which retrieves a transformed value based on the table column value. courses.findAll({ attributes: [ [sequelize.fn(‘to_char’, sequelize.col(‘session_date’), ‘Day’), ‘…

Find all records that never had status = SUCCESSFUL

I have some processes running within the backend and we are logging it in DB with its status. Now I need to find all processes that never ran successfully since last month. Example table: PID …

how to sum a column in SQL?

I am multiplying two columns of my view vDetalleEventoCaracteristicas and showing it in the Total column but now I want to sum all the records of the Total column How could I do that?

How to find a value in a column after I’ve used array_agg and struct?

After using the following code in my database, I got the following results: select USERID, array_agg(struct(ORDER_TIME, DELIVERY_TIME, PLATFORM) order by ORDER_TIME) STATS from `project.dataset….

Get the earliest record in this group with all the details

enter image description here I need only the latest record with respect to each REV.NO. There are 2 revisions for REV.NO 2, I need the 26-Feb entry alone. I have to do this to get 100,000 records. …

Access: User inputs years to query dates in that fiscal year

I want to enter the fiscal year (18/19) and have the query only select from dates within that range. The year is March 1 – Feb 28/29. Is there a way to enter the string “18/19” or “21/…

How to pick random sample while ensuring data is unique at primary key level

I have a table with data at user-date level i.e. userID date eventID A 2021-06-01 123 B 2021-06-01 342 C 2021-06-01 23487 A 2021-06-01 234221 D 2021-06-01 …