I have a number of tables, and many of them have a timestamp column. I can get a list of every table with a timestamp column: I can get the hightest timestamp in the sharks table as follows I would like to get a table like I’m suspecting this requires dynamic SQL, so I’m trying something like But …
FOR XML PATH produces only first item
I have two tables: Reservations and ReservationNights (every reservation has many nights). In a stored procedure, I have a variable that looks like this: @roomTypeList = ‘2;3;4;5;’ -> its a list of RoomUseIds. I need to display only the reservations that have a reservation nights with one of th…
Select and join with sequelize
How to make this code with the sequelize? I used include, but it brings all the user data but I only need the name my code: Answer If you just want to reduce User model attributes then just indicate needed attributes in the attributes option: If you want to add a user’s name as a string prop at the same
How to get only comma values in SQL Server
I have a employee table and I am trying to get only comma values in SQL Server. Emp table: Eid Ename 1 Peter,J 2 Mike,S 3 , 4 ,,,,,, I tried this code: I am not getting the length 0 if the values contain only commas. Expected result: I want only 3 and 4 emp ids. Answer The answer there
Add geometry column from exisiting x,y,z columns
I have a table as such: All columns are Decimal(18, 3), there are also millions of rows. I would like to add a fourth column to be a geometry point. I have tried but to no avail: Driving me insane! Cheers Answer As mentioned by @lptr in the comments, you can use STPointFromText db<>fiddle
How does a multi-column index work in MySQL?
More specifically, what data structure does MYSQL use for multi-column indexing? I know MYSQL use Btree for indexing, which can only index one column. How does multi-column indexing work then? Answer Think of a MySQL “composite” index this way. Concatenate all the columns in the index together, th…
Oracle Apex conditional icons on values in classic report
I have a follow up question based on this answer which is string based: https://stackoverflow.com/a/41556608/221270 How to achieve the same conditional color and icon formatting but based on a value: If I use the code above I got this error: ORA-20999: Failed to parse SQL query! ORA-06550: line 10, column 1: …
How to find days when workers don’t show up for work
I have a calender table for everyday in 2021. Also i have an entry table for workers everyday entries. It includes id and date columns. Calender just have date column. How can i find the days when the workers did not come? I thought searching days for every id would work Answer Left join the worker entries to…
How to increase performance when inserting more than 40k+ rows
My attempt: Currently, I am inserting a few records and it is giving exact results but in actuality, there are 40k+ records so I believe it will give performance issues also. Is there any way to insert the records faster because I will write a procedure for this insertion? Is there any other in which I can wr…
How to look for a specific thing within a table with postgres/nodejs
I’m currently using postgres, accessing it through a node server. I’m feeling stuck on how I would search for a specific term within a table in order to make a change. I know I can SELECT certain items, but I don’t know how to search within the items. say my table is: animal cuddly scary Med…