All Questions
8 questions
1
vote
1
answer
49
views
calculate days spent of all visitors from encounters
I have an encounters table
CREATE TABLE visitors(
id serial PRIMARY KEY,
start_date TIMESTAMP NOT NULL,
-- visitor_id bigint NOT NULL -- skip for now,
end_date TIMESTAMP
);
(end_date can be ...
2
votes
1
answer
189
views
Sum values by time
id_ | date_ | hour_ | in_|out_|
|…. | …. | …. | …. | ….
|19 | 2018-12-12| 18:15:00| 1 | 3 |
|19 | 2018-12-12| 18:30:00| 1 | 0 |
|19 | 2018-12-12| 18:45:00| 2 | 4 |
|...
2
votes
1
answer
4k
views
datetime row created
I have sqlserver DB , and there I have few tables.
I have 1 table that not save each row what is the datetime the each row created.
Is there any way to know when which row was created?
Is there any ...
1
vote
1
answer
3k
views
Date and time period query
I would be very grateful if someone can help me here: in my database, I have prices recorded at a particular time in a day over years. So for each vendor or station, there can be several price data ...
0
votes
1
answer
7k
views
Querying a date range
i query this SQL query:
SELECT * FROM [DB].[dbo].[Table]
WHERE [DATE] BETWEEN '01-01-2016' AND '31-03-2016'
AND ([TIME] >= '00:00:00' OR [DATE] > '01-01-2016')
AND ([TIME] <= '00:00:00' OR [...
-1
votes
1
answer
5k
views
Get currentmilliseconds in postgres
I'm working on timestamp/datetime in my application. I'm using postgres db.
What is the way to get current milliseconds (something like 1412706599000) in postgres?
3
votes
2
answers
739
views
Which of the following pieces of SQL is most efficient
I need to add the date part of GetDate() to the time part of a stored DateTime.
Naively I thought I could do the following:
declare @testTime DateTime = '2013-04-23 13:55:06'
select cast(getdate() ...
57
votes
6
answers
71k
views
How to combine date and time to datetime2 in SQL Server?
Given the following components
DECLARE @D DATE = '2013-10-13'
DECLARE @T TIME(7) = '23:59:59.9999999'
What is the best way of combining them to produce a DATETIME2(7) result with value '2013-10-13 ...