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 8693913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:39:18+00:00 2026-06-13T00:39:18+00:00

Why doesn’t this query work? SELECT ROW_NUMBER() OVER ( ORDER BY DocumentID ) peta_rn

  • 0

Why doesn’t this query work?

SELECT ROW_NUMBER() OVER (
        ORDER BY DocumentID
        ) peta_rn
    , d.DocumentID
    , d.IsReEfiled
    , d.IGroupID
    , d.ITypeID
    , d.RecordingDateTime
    , dbo.GetLatestStatusDateTime(d.DocumentID) AS LatestStatusDatetime
    , dbo.FnCanChangeDocumentStatus(d.DocumentStatusID, d.DocumentID) AS CanChangeStatus
    , d.IDate
    , d.InstrumentID
    , d.DocumentStatusID
    , ig.Abbreviation AS IGroupAbbreviation
    , u.Username
    , j.JDAbbreviation
    , inf.DocumentName
    , it.Abbreviation AS ITypeAbbreviation
    , d.DocumentDate
    , ds.Abbreviation AS DocumentStatusAbbreviation
    , dbo.GetFlatDocumentName(d.DocumentID) AS FlatDocumentName
FROM Documents d
INNER JOIN IGroupes ig
    ON d.IGroupID = ig.IGroupID
LEFT JOIN ITypes it
    ON d.ITypeID = it.ITypeID
LEFT JOIN Users u
    ON u.UserID = d.UserID
LEFT JOIN DocumentStatuses ds
    ON d.DocumentStatusID = ds.DocumentStatusID
LEFT JOIN InstrumentFiles inf
    ON d.DocumentID = inf.DocumentID
INNER JOIN Jurisdictions j
    ON j.JurisdictionID = d.JurisdictionID
WHERE 1 = 1

whereas this one works:

SELECT ROW_NUMBER() OVER (
        ORDER BY d.DocumentID
        ) peta_rn
    , d.DocumentID
    , d.IsReEfiled
    , d.IGroupID
    , d.ITypeID
    , d.RecordingDateTime
    , dbo.GetLatestStatusDateTime(d.DocumentID) AS LatestStatusDatetime
    , dbo.FnCanChangeDocumentStatus(d.DocumentStatusID, d.DocumentID) AS CanChangeStatus
    , d.IDate
    , d.InstrumentID
    , d.DocumentStatusID
    , ig.Abbreviation AS IGroupAbbreviation
    , u.Username
    , j.JDAbbreviation
    , inf.DocumentName
    , it.Abbreviation AS ITypeAbbreviation
    , d.DocumentDate
    , ds.Abbreviation AS DocumentStatusAbbreviation
    , dbo.GetFlatDocumentName(d.DocumentID) AS FlatDocumentName
FROM Documents d
INNER JOIN IGroupes ig
    ON d.IGroupID = ig.IGroupID
LEFT JOIN ITypes it
    ON d.ITypeID = it.ITypeID
LEFT JOIN Users u
    ON u.UserID = d.UserID
LEFT JOIN DocumentStatuses ds
    ON d.DocumentStatusID = ds.DocumentStatusID
LEFT JOIN InstrumentFiles inf
    ON d.DocumentID = inf.DocumentID
INNER JOIN Jurisdictions j
    ON j.JurisdictionID = d.JurisdictionID
WHERE 1 = 1

As you can see the only difference is I specify d.DocumentID. Is there anyway I can avoid having to specify d.DocumentID and instead specify only DocumentID without using an extra Select? because after all, all documentID refer to the same value.

  • 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-13T00:39:19+00:00Added an answer on June 13, 2026 at 12:39 am

    The problem is that DocumentID is in both tables InstrumentFiles and Documents, so how would the query engine know which one you are referring to?

    So in short, No, you have to specify d.DocumentID in this instance.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Why doesn't the CAST work in this MySQL query? SELECT MAX(Signups) AS Max, MIN(Signups)
This doesn't work: int number = 1; String numberstring = IntToString(number); I get The
Why doesn't this code work? b if b = true Error: undefined local variable
Why doesn't this work? Some Usercontrol (name: myUserControl) with an image control (name: myImage):
Why doesn't this test case work? <?php // cards with cyrillic inidices and suits
Why doesn't this work? I have bypassed this before but i can't remember how
Why doesn't this work? type RetryBuilder(max) = member x.Return(a) = a // Enable 'return'
Why doesn't this work? Can Anyone tell me whats wrong with this onitemclicklistener? It
Why doesn't this work? HTML <div class=gallery> <div class=viewport> <div class=wrapper> <img src=img/boat1.png />
Doesn't seem to be anything about this online, I need to run fetch query

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.