Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7999849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:37:14+00:00 2026-06-04T15:37:14+00:00

I have an Oracle query select max(m.id), m.someId keep (DENSE_RANK FIRST ORDER BY m.UpdateDate

  • 0

I have an Oracle query

select max(m.id),
       m.someId keep (DENSE_RANK FIRST ORDER BY m.UpdateDate desc) 
from MyTable m 
groupBy m.someId

which for data like this:

id UpdateDate someId
1  20-01-2012 10
2  20-01-2012 10
3  01-01-2012 10
4  10-02-2012 20
5  01-02-2012 20
6  01-04-2012 30

will return me exactly this:

2 10
4 20
6 30

So, for every someId it searches for latest updateDate and does return the appropriate id. (And if there are a several ids for the latest dates it takes latest id).

But for SQL server will this query work the same way? I mean this construction keep (dense_rank first order by ..)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T15:37:15+00:00Added an answer on June 4, 2026 at 3:37 pm

    I don’t think that your particular query will run SQL Server. But you can achieve the same result doing this:

    SELECT id, SomeId
    FROM (  SELECT *, ROW_NUMBER() OVER(PARTITION BY someId ORDER BY UpdateDate DESC, id DESC) Corr
            FROM MyTable) A
    WHERE Corr = 1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple query in php on oracle: $query='select u.username,u.lastname,u.firstname,c.event,c.reason from users u,
I have an oracle sql query select distinct tab1.col1, tab2.col1 from table1 tab1 join
I have the following Oracle query SELECT * FROM table WHERE date_opened BETWEEN ((TO_DATE('2011-08-01',
I have a oracle query: select * from table1,table2 where table1.id1 = table2.id2 and
I have the following query SELECT McId, MAX(TimeDone) FROM Trace WHERE PcbId = 'C825514362'
I have the following oracle query which runs fine SELECT c.customercode, s.sales_id FROM customers
I have a following oracle query: SELECT a.USER_ID, c.first_name, c.last_name, TO_CHAR( b.logon_date, 'MM/DD/YYYY HH:MI:SS
I have a join in a oracle query which looks like: FROM eiv.table1 eiv.table2
I have a middle size query with 500.000 registers from an Oracle to an
I have the following Oracle query: SELECT id, DECODE(state, 'Open', state_in, NULL) AS open_in,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.