I need to update a certain alert on a loan where the obligor and obligation is something, but I can’t figure out what I’m doing wrong in the join. This seems to update all alerts in the table rather than the specific one I want. We are using postgresql db Answer Workbench usually refers to MySQL. …
Data inserting in between the rows in table
I have a table which has around 1,000,000 records. I noticed that when I insert a record it does not get inserted at last instead it gets inserted in between Example My table (testing) Si. Name. Address. 1. Test. 1/2 test 2. Test. 3/4 test Si has a unique index created but no primary keys defined So when I ma…
How to generate dynamic table having begin month date and end month date Teradata or SAS SQL
I’d like to generate a dynamic Table with the start date of a month as a column and the end date of the month as another column. Ideally, I’d like to provide two years, f.e. 2016 and 2021. The output I’d like to have when providing these two years is the following: Kindly note that I require the output for…
Need help finding syntax error in SQL code [closed]
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. Want to improve this question? Update the question so it’s on-topic for Stack Overflow. Closed 9 months ago. Improve this question I have been trying to follow along with a SQL tutorial on YT. Every …
How to create custom WEEKOFYEAR index in Snowflake?
I am trying to custom build a week index (1-52) The logic should be like: Start with the 1st Saturday of January of a year Build custom intervals from every Saturday (start of the week) to Fridays (end of the week) and increment the week index by 1. Example: Week 23 will include July 3 2021 – July 9 202…
Accurate DateDiff
I have 2 time fields in SQL. I want to calculate the difference between start time and end time in hours. From 7 AM in the morning to 7:30 PM it would be 12.5 hours but the datediff function returns 12 hours because it returns an integer. I also tried converting it to seconds: All of these return 12 hours
MySQL: Error 1045 – how to set correct rules?
I have MySQL db and need to create a new database. However, I can not do it since I keep getting the 1045 Error. shows following: I don’t even have enough rights for rewoking and granting or creating a new user. Could you please help me what to do? Answer You only have privileges on a schema named db. Y…
Order by multiple columns in the SELECT query
How can i order the results in my select query to have them like this? I tried this query but the result is not what I’m looking for: In which col1 represents the first number, col2 is the second one and col3 is the last number in the above example. This query returns: Thanks Answer Sort should be 1-3-2…
MySQL Difficult Where Clause
I need help with a difficult query which I may not explain well with words. The query needs to only return results where all the characters in the code column are in the where clause. Say I had the following table and wanted to return the code and position where ABC. Table: code position ABC 100 ABCD 200 ABCD…
Select from one table if present,else select from another having latest date
There are Three tables T1 and T2 and T3 T3 stores person details T1 stores primary phone number of person, T2 stores non primary phone number of persons. T1 Personid Primaryphone dateload 1 1001 02/08/21 2 1002 03/07/21 4 1004 04/08/20 5 1005 08/09/20 T2 Personid NonPrimphone dateload 1 1011 12/03/21 3 1003 2…