| |

VerySource

 Forgot password?
 Register
Search
View: 825|Reply: 4

Help for a SQL statement

[Copy link]

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-2-13 19:30:01
| Show all posts |Read mode
I have a table table1
vid vname vyear vmonth vday vhour vminute
001 james 2016 12 1 17 10
001 james 2016 12 1 20 12
001 james 2016 12 2 8 20

I want to delete the records of the time period based on the time period
example
2016/12/1 19:30-2016/12/2 8:30

After the implementation, the first two records are deleted. How do I write this statement!
Reply

Use magic Report

0

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-4-18 11:15:01
| Show all posts
delete from table1 where to_date (vyear || '/' || vmonth || '/' || vday || '' || vhour || ':' || vminute, 'yyyy / mm / dd hh24: mi') between to_date ('2016/12/1 19:30', 'yyyy / mm / dd hh24: mi') and to_date ('2016/12/2 8:30', 'yyyy / mm / dd hh24: mi') ;
Reply

Use magic Report

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-4-28 14:15:02
| Show all posts
暗夜执行官Hello
I executed your statement but there was an error

ORA-01847: The number of times in the month must be between 1 and the last day of the month.
Reply

Use magic Report

0

Threads

8

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 Invalid IP Address

Post time: 2020-5-1 16:45:01
| Show all posts
Check the VDAY field in your table to see if it exceeds the last day of the month
For example, there will be no 30th in February
Or stitch them together to check
Reply

Use magic Report

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-5-24 20:15:01
| Show all posts
Really likesanshuimeisaid
In December, there was a record of vday = 32, deleted ok.

Thank暗夜执行官,sanshuimei
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list