I know a little bit of sql, only the basic, now I need to create a analytic query but can’t do this yet. I have 2 tables on my db oracle, client and exams: I am tried a lot of ways to get the mean of exams by client, but no success yet.4 The result expected is: exams = 13
Tag: sql
Between the time in SQL Server and ASP.NET
I am storing STARTTIME and ENDTIME in a SQL Server table by using ASP.NET webform. Now, as you can see in the row with timeTableID = 2, the inserted time value is 8:00 & 8:30 AM, But in the row with timeTableID = 3, the inserted time value is 8:15 & 8:25 AM, I don’t want this because its within
Based on previous records, stop sum fields
I have a table like this: My goal is to obtain sum of points from date now to date that the point is greater than equal to 1 and stop sum of fields before that date. In the example above (order by date), the answer is sum of points date now(2022/01/06) to the date 2022/01/04 and equals 9 + 7
What does INTERVAL ‘182’ DAY(3) mean in SQL / Oracle?
Trying to understand INTERVAL and DAY(3) usage in SQL, as I’ve come across it and need to understand what it means. It’s in a WHERE clause, seen below WHERE POSTING_DATE > CURRENT_DATE – INTERVAL ‘182’ DAY(3) Help needed, thanks! Answer From the documentation: INTERVAL DAY TO …
Passing Variable to SQL insert statement
I know this code here selects columns from one table and inserts it into another table. However, I have a value that I want to insert into one of the columns, how do I pass in the value? This selects from on table and inserts into another… However, I want column1 to have a value that I set above the
Include Medians for grouped query .
I have this query that I need to graph. The graph will show Total patients, patient Longest wait (minutes) and patient Median wait for each location. I need to include Medians in my query, and that is where I am stuck. Example Raw Data: Query I have so far w/o Medians: Output: I need help getting a last colum…
SQL Query for multiple Pivot on same column
As per my requirement, I need to apply pivot twice on same column to get different values as column header. Please see below how the data is present in table and expected results. Table Question Response TranslatedResponse activityid createdon Reason Testing testaus 1 01-01-2022 EMail abc@gmail.com abc@gmail.…
SQL fill empty values in a column based on case when selection
So basically what I want to achieve is that if four columns are empty, one column contains a 1 as value and one column contains 0, then I want to entries in one column meeting the conditions with a default value (0.06077). Meaning: IF COL_A, COL_B, COL_C, COL_D IS NULL and COL_E = 0 AND COL_F = 0 then fill
Transpose rows to columns using multiple pivots
I am trying to transpose rows to columns without any luck . What I have now WEEK_NUMBER VAL9 VAL4 VAL5 VAL7 45 63.27% 28.58% 7.92% 0.23% 52 65.66% 26.16% 7.80% 0.38% 50 90.97% 8.45% 0.29% 0.29% 46 82.49% 12.43% 3.01% 2.06% 47 66.33% 29.53% 3.77% 0.36% 51 65.36% 31.83% 2.69% 0.11% 49 61.88% 28.29% 9.46% 0.37% …
Postgres Timestamp to DATE dd-mm-yyyy
im trying to insert select a casted timestamp in a date colum timestamp like 02-09-2021 00:00:00, and i need to convert this timestamp to date dd-mm-yyyy without hhmmss, i’ve tried select date(column) as newdate but when i check my table insert, it keeps like timestamp, all the solutions that i tried on…