Oracle SQL Select Only 5 Digit Row in a Column [closed] - sql

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 2 years ago.
Improve this question
SELECT *
FROM GNGRB.CLAIM
WHERE ZOCRECDT IS NOT NULL;
SLNO Column select only 5 digit row

Please use length function of oracle. For e.g:
select *
from table a
where length(a.column_name) = 5
In your case
SELECT *
FROM GNGRB.CLAIM
WHERE ZOCRECDT IS NOT NULL
and LENGTH(SLNO) = 5

Related

Take 2 digit after comma sql [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 months ago.
Improve this question
So, i have column with data type float. i want to take 2 digit after comma
example
0.622
i want the result is
0.62
i already tried some solution from stack overflow but still the result is 0.61.
sum(CASE WHEN a.TOTALBUDGET>bo.Bobot*2 then bo.Bobot*2 else a.totalbudget end) as UW_Rank
sum(CASE WHEN a.TOTALBUDGET>bo.Bobot*2 then bo.Bobot*2 else CAST(ROUND(a.totalbudget,2,1)AS NUMERIC(18,2)) end) as UW_Rank_Test
thanks
Did you tried round function.
declare #val float = '0.622'
SELECT ROUND(#val, 2);

In Sql developer ,How to remove the last 3 digit from string in all rows for one column? [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 9 months ago.
Improve this question
Colum2
Karim_bk
Karim_bk
Karim_bk
Want result Karim
This should work
select top 10 Lastname, LEFT(Lastname, LEN(Lastname) - 3) as TrimmedVersion from tablename
Hope this will help you. In Oracle:
SELECT SUBSTR(column_name, 0, LENGTH(column_name) - 2) from table_name;
--SELECT SUBSTR('karim_bk', 0, LENGTH('karim_bk') - 2) from dual; --karim

query to check multiple revsions on a table [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 5 years ago.
Improve this question
Need a query to check ids with multiple revisionnums
id reviionnum
1 0
2 0
1 1
3 1
2 1
The query should result
id revisionnum
3 1
Please help
If you want ids with only one revision number, you can use aggregation:
select id, min(revissionnum)
from t
group by id
having count(*) = 1;
The min() is the value if there is only one row.

Select a part of a selected item in sql [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
How can I possibly select a part of a row data in MS Sql?
ex. Charmina (Female)
All I want to select is the Female not the whole Charmina (Female)
Try this
select substring('Charmina (Female)',
charindex('(','Charmina (Female)')+1,
LEN('Charmina (Female)')-charindex('(','Charmina (Female)')-1)
or
select stuff('Charmina (Female)',1,charindex('(','Charmina (Female)')-1,'')
You may Use SUBSTRING to get sub sequences of strings
SELECT SUBSTRING( your_Raw ,start , length ) AS Alias
FROM Your_Table

Assign values to sorted result in SQL [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 9 years ago.
Improve this question
I have got table like below after sorting in SQL:
M_ID
-----
2013/01
2013/02
2013/03
2013/04
2013/05
2013/06
Now I want to assign each entries a particular value like below
M_ID Days
--------------
2013/01 20
2013/02 30
2013/03 40
2013/04 50
2013/05 60
2013/06 70
So, can you please let me know how to do that in SQL Query?
Do you mean something like this (presuming sql-server)?
SELECT M_ID,
Days = (ROW_NUMBER()OVER(ORDER BY M_ID) + 1) * 10
FROM dbo.TableName
Demo