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 2 years ago.
Improve this question
Some can help me on this query? I need this
You can use the exists as follows:
Select cr_no, so, id
From your_table t
Where exists (select 1 from your_table tt
Where t.cr_no <> tt.cr_no
And t.so = tt.so
And t.id = tt.id)
Related
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 10 months ago.
Improve this question
how to rank each country based on number of people in SQL.
Try
SELECT * FROM (
SELECT country, count(people) as count FROM your_table GROUP BY country
) ORDER BY count DESC
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
How can I write this query without TOP and Limit only use the SQL
You just sort the data one way, grab the records you want, then sort it the other way:
SELECT SOME_FIELD
FROM (SELECT st.*
FROM SOME_TABLE st
ORDER BY SOME_FIELD DESC)
WHERE ROWNUM <= 7
ORDER BY SOME_FIELD ASC
dbfiddle here
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 3 years ago.
Improve this question
I have data with column createdate like '24/04/2019 14:52:38',24/04/2019 14:52:37,24/04/2019 14:52:35,24/03/2019 14:52:38 etc.
how to get data based on max date and time in SQL query.
select
top(1) *
from
xx
order by
createdate desc
something like this? (works if createdate column is of date/datetime/timestamp type)
select
*
from
<table_name>
where
createdate = (select
max(createdate)
from
<table_name>)
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 4 years ago.
Improve this question
Declare #record_status varchar(50)
İf #record_status=‘X’
#record_status=‘A’
Else if #record_status Is null
#record_status=‘’’A’’,’’P’’’
Select*from .....where RECORD_STATUS in(#record_status)
Else if not searching in the sql somebody help to me
IF you mean what I think you mean, this could do it...
SELECT
*
FROM
yourTable
WHERE
(#record_status = 'X' AND table.record_status = 'A')
OR
(#record_status IS NULL AND table.record_status IN ('A', 'P'))
But your post is very vague ;)
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 9 years ago.
Improve this question
I have a Calisma Database and it has DosyaNo and SiraNo columns.
I want to set SiraNo where DosyaNo is same for example
DosyaNo ____________SiraNo
0.00000000__________1
0.00000000__________2
0.00000000__________3
0.00000000__________4
0.00000000__________5
---------------------
0.10000000__________1
0.10000000__________2
0.10000000__________3
0.10000000__________4
0.10000000__________5
-----------------------
0.70000000__________1
0.70000000__________2
0.70000000__________3
------------------------
7.10000000__________1
7.10000000__________2
You can use CTE for that
WITH cte AS
(
SELECT DosyaNo, SiraNo,
ROW_NUMBER() OVER (PARTITION BY DosyaNo ORDER BY (SELECT NULL)) rnum
FROM table1
)
UPDATE cte
SET SiraNo = rnum
Here is SQLFiddle demo