Skip to content
Advertisement

Category: Questions

SQL DATEPART(qq, @date) date quarter start October

I have a query that prints the data grouped quarter, the query uses datepart(qq,repo.lesson_date) SQL function. My issue is I want my first quarter to be October-December and not Jan-March like the output I get from the SQL function above. Is there anyone can assist? Answer You may use an additional calculation (DATEPART(qq, repo.lesson_date) % 4 + 1) as a

SELECT from table with count from another

I have 2 mysql tables I need to get all views by user, but also need to get the user role (for each view) and calculate a dynamic number of users used for every view. So, I need to get all view columns, plus the role of the user which do this request (from ViewUser), plus count of users for

SQL Query for the player and vsplayer [closed]

Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed last year. Improve this question Team Table Expected Output: with Two columns How to write a sql query to get the exact output as Expected output mentioned above. Thanks in advance

sql Select the max value within a combination of starting time and ending time

I have a database as the data table below. Its a standard Open High Low Close Database. I wanna select the date, start-time, end-time, max([high] over ***The period of time) , and Close Data Table date time high 20100104 94000 21850 20100104 94500 21903 20100104 95000 21875 20100104 95500 21855 20100104 100000 21904 20100104 100500 21922 20100104 101000 21935 20100104

how to query get value without id

I want to get the value of the column regardless of the id of the table, because I want to use GROUP BY to concatenate them from the table : id_child id_master test1 test2 test3 1 1 1 1 0 2 1 1 0 0 3 1 1 0 0 4 2 1 0 0 5 2 1 0 0

Round to nearest 15 minute interval

I’ve seen this question asked and answered for time that is stored as a date, but I have duration of hours and minutes stored as numeric(4,2). For example 2.12, is 2 hours 12 minutes. I need to round that to the nearest 15 minute interval, doing this (CONVERT([numeric](4,2),round(2.12/(25),(2))*(25))) doesn’t work because it’s base 10 and rounds time incorrectly. Any help

Advertisement