eu tenho os dados assim
Eu quero abaixo resultado.
Tenho uma tabela com muitos dados. Quando tento inserir dados anteriores a 3 anos, gostaria que os dados fossem inseridos em outra tabela.
Minha mesa está assim.
Id SecurityID Date Open High Low Close Volume OpenInit
462151 998 2016-08-16 37740.0 37740.0 37570.0 37630.0 0.00000 0.00000
462152 998 2016-08-17 37780.0 37830.0 37710.0 37760.0 0.00000 0.00000
462153 998 2016-08-18 37600.0 37800.0 37600.0 37760.0 0.00000 0.00000
462478 999 2017-01-24 46970.0 47480.0 46660.0 47310.0 0.00000 0.00000
462479 999 2017-01-25 47480.0 48630.0 47440.0 48380.0 0.00000 0.00000
462480 999 2017-01-26 48100.0 48690.0 47940.0 48310.0 0.00000 0.00000
462789 1000 2017-06-02 45680.0 45800.0 45500.0 45640.0 0.00000 0.00000
462790 1000 2017-06-05 45200.0 45650.0 45090.0 45420.0 0.00000 0.00000
462791 1000 2017-06-06 45390.0 45530.0 45120.0 45350.0 0.00000 0.00000
Preços da tabela:
ID Date OPEN HIGH Low CLOSE
417 9/23/1994 24.399 24.399 24.399 24.399
417 9/28/1994 23.3 23.3 23.3 23.3
417 9/29/1994 23.35 23.35 23.35 23.35
417 9/30/1994 22.55 22.55 22.55 22.55
418 5/22/2014 47.299 47.299 47.299 47.299
418 5/23/2014 47.299 47.299 47.299 47.299
418 5/26/2014 47.1 47.1 47.1 47.1
418 5/27/2014 47.35 47.35 47.35 47.35
Eu quero o resultado assim:
id Open HIGH LOW CLOSE PervClose Change Change%
417 22.55 22.55 22.55 22.55 23.35 22.55-22.55 (22.55-22.55)/100
418 47.35 47.35 47.35 47.35 47.1 47.35-47.1 (47.35-47.1)/100
Nota:((prevclose é anteriordataclose,change=close-prevclose),change%=(close-prevclose)/100)
tenho duas tabelas assim
Tc_Date
2016-02-01 00:00:00
2016-02-02 00:00:00
2016-02-03 00:00:00
2016-02-04 00:00:00
2016-02-05 00:00:00
2016-02-06 00:00:00
2016-02-07 00:00:00
2016-02-08 00:00:00
2016-02-09 00:00:00
2016-02-10 00:00:00
e
EmpID Office_Date Login_Time Logout_Time
397 2016-02-01 00:00:00 2016-02-01 08:35:09.780 2016-02-01 17:18:56.230
397 2016-02-02 00:00:00 2016-02-02 08:28:50.713 2016-02-02 17:10:36.997
397 2016-02-03 00:00:00 2016-02-03 08:27:38.550 2016-02-03 17:22:49.037
397 2016-02-04 00:00:00 2016-02-04 08:34:26.653 2016-02-04 17:11:04.540
397 2016-02-05 00:00:00 2016-02-05 08:36:12.833 2016-02-05 17:07:22.797
397 2016-02-09 00:00:00 2016-02-09 08:35:58.840 2016-02-09 17:15:40.203
397 2016-02-10 00:00:00 2016-02-10 08:30:51.940 2016-02-10 17:08:58.480
396 2016-02-01 00:00:00 2016-02-01 08:42:39.000 2016-02-01 17:57:39.000
396 2016-02-02 00:00:00 2016-02-02 07:49:36.090 2016-02-02 17:05:00.470
396 2016-02-03 00:00:00 2016-02-03 07:49:54.583 2016-02-03 17:14:57.663
396 2016-02-04 00:00:00 2016-02-04 07:54:15.087 2016-02-04 17:05:38.373
396 2016-02-05 00:00:00 2016-02-05 07:51:12.133 2016-02-05 17:00:42.870
396 2016-02-08 00:00:00 2016-02-08 07:58:06.833 2016-02-08 17:01:52.750
396 2016-02-09 00:00:00 2016-02-09 07:56:26.730 2016-02-09 17:04:31.650
396 2016-02-10 00:00:00 2016-02-10 07:43:16.463 2016-02-10 17:03:19.480
eu quero a resposta assim
Empid 2016-02-01 2016-02-02 2016-02-03 2016-02-04 2016-02-05 2016-02-06...
397 08:35:09 08:28:50 08:27:38 08:34:26 08:36:12 Absent
396 08:42:39 07:49:36 07:49:54 07:54:15 07:51:12 Absent
Tenho a tabela assim:
ID Office_Date Login_Time
397 2015-09-21 00:00:00 2015-09-21 09:00:00.000
397 2015-09-22 00:00:00 2015-09-22 10:00:04.000
397 2015-09-23 00:00:00 2015-09-23 08:13:41.967
397 2015-09-24 00:00:00 2015-09-24 08:16:29.267
397 2015-09-25 00:00:00 2015-09-25 08:12:41.510
397 2015-09-28 00:00:00 2015-09-28 08:10:23.200
397 2015-09-29 00:00:00 2015-09-29 08:15:57.493
397 2015-09-30 00:00:00 2015-09-30 08:19:33.973
397 2015-10-01 00:00:00 2015-10-01 08:22:52.790
Eu quero ficar assim:
id logintime>7'oclock logintime >7:30 logintime>8'0 clock
397 0 0 5