| |

VerySource

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

Retrieve data by fuzzy query

[Copy link]

1

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-1-2 21:00:01
| Show all posts |Read mode
I want to write a date specific to the year and month and then retrieve the data. In ms-sql,
My date field type smalldatetime type

Is it written like this, select * from where date like '% 2006-12%'
Reply

Use magic Report

0

Threads

88

Posts

55.00

Credits

Newbie

Rank: 1

Credits
55.00

 China

Post time: 2020-1-2 21:03:02
| Show all posts
select * from where convert (char (7), date, 21) like '2006-12'
Reply

Use magic Report

1

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

 Author| Post time: 2020-1-2 22:06:01
| Show all posts
Thanks, solved
Reply

Use magic Report

0

Threads

93

Posts

46.00

Credits

Newbie

Rank: 1

Credits
46.00

 China

Post time: 2020-1-2 22:12:01
| Show all posts
select * from ta where convert (varchar (6), time column, 112) = '200701'
Reply

Use magic Report

0

Threads

93

Posts

46.00

Credits

Newbie

Rank: 1

Credits
46.00

 China

Post time: 2020-1-2 22:15:01
| Show all posts
Time conversion is so efficient
The landlord can refer to the online help
About time conversion (using convert)
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