Reputation: 75
i have the following query,
INSERT INTO Table[B] SELECT * FROM Table[A] WHERE (date between '2006-03-01 00:00:00' and '2006-05-31 23:59:59' and hour(date) between 5pm and 9am );
but it is not working .
actually i want to insert values form A to B having time 05pm to 09am
any solution please .
Upvotes: 1
Views: 38
Reputation: 1270421
I would expect something like this:
INSERT INTO TableB (col1, col2, . . .)
SELECT col1, col2, . . .
FROM TableA
WHERE date >= '2006-03-01' AND date < '2006-06-01' AND
(hour(date) < 9 OR hour(date) > 17);
Notes:
insert
.>=
and <
.Upvotes: 1