In a SQL statement, I want to get only the date from a cell that contains the date and time.
Specifically, I would like to do as follows.
| date | id |
| 2010/5/10 12:10:00 | A |
| 2011/6/10 13:10:00 | B |
| 2011/10/10 12:10:00 | D |
Data I want to output
| date | id |
| 2010/5/10 | A |
| 2011/6/10 | B |
| 2011/10/10 | D |
Even if I try to use the following query using cast, only the age is acquired and the date cannot be acquired.
If anyone knows how to deal with it, would you please let me know?
select CAST (date as DATE), id from test
Answer # 1
Please try as follows.
select date (date), id from test
I think it's an item name for a question, but if it's actually a reserved word, it's better to change it.
- python - i want to get only the latest data with nosql
- mysql - [sql] i want to extract only non-duplicate data
- ios - i want to get only 0 from the array of 0s and 1s
- ruby - i want to get only value from nested json
- i want to post and get data to db using laravel
- xcode - i want to get location information
- i want to output only "err" of expect("err") with rust
- linux - i want to get the last part of the echoed string
- php - i want to get the key of a multidimensional array
- i want to get the string that i got with nodejs
- sql - i want to number them regularly
- i want to get the date from a string in python
- php - i want to get the parent page in the wp breadcrumbs
- ruby on rails - i want to get related objects all at once
- sql server - i want to set a flag using a case statement
- java - i want to get the numbers from two arrays
- sql - i want to add a cumulative value
- i want to find the sql id
- sqlite : How to choose the values that are in the same table, but not in another?
- Error in SQL statement -missing character;
- c# : How do I write the value of a variable to the Unity database?
- About text type filter operation after changing Access DB to Azure SQL
- python : 'NoneType' object is not subscriptable. Help
- java : Big query problem in SQLite3 via hibernate
- c# : The query runs in Access, but doesn't work when executed from c code #
- How to add items to cart in sql?
- python : How to check for missing data in the table?
- SQL duplicate rows when joining multiple tables