Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # server TO try it OUT: https://rextester.com/l/sql_server_online_compiler -> SQL server
- # desired RESULT IS TO SELECT every SECOND VALUE per DAY: (1,2), (2,2), (3,2)
- CREATE TABLE test_ts(
- DAY INT,
- val INT
- );
- INSERT INTO test_ts (DAY, val)
- VALUES
- (1,1),
- (1,2),
- (1,3),
- (1,4),
- (2,1),
- (2,2),
- (2,3),
- (2,4),
- (2,5),
- (3,1),
- (3,2),
- (3,3),
- (3,4),
- (3,5);
- SELECT * FROM test_ts
- SELECT DAY, val FROM test_ts t
- WHERE t.val=2
- ORDER BY DAY
Add Comment
Please, Sign In to add comment