How to update only the year of the date column in a table - sql oracle [closed] - sql

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
I was looking for the query which can update only the year of the date column to 2019.

yes you can,
if the field of the date for you mydate from table_name, you can do:
Update table_name
set column_name = Add_months(sysdate, -(extract(year from sysdate)-extract(year from mydate))*12)
where <where_condition>;

Related

SQL update set and select issue, [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 months ago.
Improve this question
I have this code:
SELECT
ZONE_NAME,
ORG_ID,
ORG_SHORT_NAME,
XMSSN_USE
FROM TABLEZ
;
UPDATE TABLEZ
SET TABLEZ.BILL_CYCLE = '1-DEC-2020 4' WHERE (SELECT TABLEZ.XMSSN_USE WHERE TABLEZ.XMSSN_USE=224)
But it doesn't seem to execute. What could be the problem?
You have 2 different query sentences. You should use ; after first query and then write the update query.
Also you need to use some field on the where clause, your where is empty.

How to find records 2 years from a created date stored in the individual record [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
Need help in writing an MS SQL query to delete all data in a table, 2 years or more from when it was originally added. created_date is stored as datetime field type.
Table: users
user_id
user_name
created_date
Try this
DELETE FROM <your_table> WHERE created_date < DATEADD('yy', -2, getdate())
SELECT *
FROM [database].[dbo].[users] where created_date < DATEADD(year,-2,GETDATE())

sql same table same column but two data [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
TABLE1
NAME
1. AHMET
2. MEHMET
3. VELİ
4. TEMEL
Select * from TABLE1 WHERE NAME='AHMET' and NAME='VELİ'
Probaly you want IN operator:
Select * from TABLE1 WHERE NAME IN('AHMET', 'VELİ')

How to get total count of orders placed on spesific date using Raw query [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have ORDER Table in which I am saving Orders date wise.
Now I want total number of orders placed on specific date
How to do that
Pls Help...
Try this:-
SELECT COUNT(*)
FROM TABLE_NAME
WHERE DATE_COL = 'YOUR_DATE'

Problems with SQL query finding three names with the most records [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have a table and I want to display the 3 names (Ted, Ringo, Paul) that have the most records using an SQL query.
It's a primitive question, but please help me.
my table:
SELECT TOP 3 Name
FROM YourTable
GROUP BY Name
ORDER BY COUNT(*) DESC