Click here to Skip to main content
13,799,534 members
   

Database

 
GeneralRe: Identity behavior in sql server 2008 and 2012 Pin
VK199-Mar-18 8:43
memberVK199-Mar-18 8:43 
AnswerRe: Identity behavior in sql server 2008 and 2012 Pin
jschell10-Mar-18 11:30
memberjschell10-Mar-18 11:30 
GeneralRe: Identity behavior in sql server 2008 and 2012 Pin
VK1912-Mar-18 3:27
memberVK1912-Mar-18 3:27 
GeneralRe: Identity behavior in sql server 2008 and 2012 Pin
jschell14-Mar-18 16:16
memberjschell14-Mar-18 16:16 
Questionmerge to output matched and not matched Pin
indian14328-Feb-18 12:09
memberindian14328-Feb-18 12:09 
AnswerRe: merge to output matched and not matched Pin
Jörgen Andersson7-Mar-18 12:07
protectorJörgen Andersson7-Mar-18 12:07 
Questionsql query to get code with max rank Pin
Member 927852427-Feb-18 7:55
memberMember 927852427-Feb-18 7:55 
AnswerRe: sql query to get code with max rank Pin
Richard Deeming27-Feb-18 8:58
mvpRichard Deeming27-Feb-18 8:58 
Something like this should work:
WITH cteOrderedBillingCodes As
(
    SELECT
        T.BillingAccountKey,
        T.BillingCode,
        R.Rank,
        ROW_NUMBER() OVER (PARTITION BY T.BillingAccountKey ORDER BY R.Rank DESC) As RN
    FROM
        #BillingTransactions As T
        INNER JOIN #BillingCodeRank As R
        ON R.BillingCode = T.BillingCode
)
SELECT
    A.UserAccount,
    A.AccountType,
    A.BillingAccountKey,
    C.BillingCode,
    C.Rank
FROM
    #UserAccount As A
    LEFT JOIN cteOrderedBillingCodes As C
    ON C.BillingAccountKey = A.BillingAccountKey
    And C.RN = 1
WHERE
    A.AccountType = 'O'
;

ROW_NUMBER (Transact-SQL) | Microsoft Docs[^]



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


AnswerRe: sql query to get code with max rank Pin
Paket Wisata Lombok28-Feb-18 7:01
professionalPaket Wisata Lombok28-Feb-18 7:01 
QuestionUnable to find Postgresql data source in Entity Data Model Wizard Pin
Sudhir Dehade27-Feb-18 2:19
memberSudhir Dehade27-Feb-18 2:19 
Rant[REPOST] Unable to find Postgresql data source in Entity Data Model Wizard Pin
Richard Deeming27-Feb-18 3:12
mvpRichard Deeming27-Feb-18 3:12 
RantRe: [REPOST] Unable to find Postgresql data source in Entity Data Model Wizard Pin
Richard Deeming27-Feb-18 3:20
mvpRichard Deeming27-Feb-18 3:20 
GeneralRe: [REPOST] Unable to find Postgresql data source in Entity Data Model Wizard Pin
Richard Deeming27-Feb-18 3:26
mvpRichard Deeming27-Feb-18 3:26 
GeneralRe: [REPOST] Unable to find Postgresql data source in Entity Data Model Wizard Pin
Sudhir Dehade27-Feb-18 3:30
memberSudhir Dehade27-Feb-18 3:30 
QuestionTable Database Advice Pin
JackMisani22-Feb-18 1:36
memberJackMisani22-Feb-18 1:36 
AnswerRe: Table Database Advice Pin
Richard Deeming22-Feb-18 1:53
mvpRichard Deeming22-Feb-18 1:53 
GeneralRe: Table Database Advice Pin
JackMisani22-Feb-18 3:10
memberJackMisani22-Feb-18 3:10 
GeneralRe: Table Database Advice Pin
Mycroft Holmes22-Feb-18 13:15
memberMycroft Holmes22-Feb-18 13:15 
GeneralRe: Table Database Advice Pin
JackMisani25-Feb-18 23:43
memberJackMisani25-Feb-18 23:43 
AnswerRe: Table Database Advice Pin
Eddy Vluggen22-Feb-18 7:51
professionalEddy Vluggen22-Feb-18 7:51 
AnswerRe: Table Database Advice Pin
jschell23-Feb-18 14:44
memberjschell23-Feb-18 14:44 
GeneralRe: Table Database Advice Pin
JackMisani25-Feb-18 23:49
memberJackMisani25-Feb-18 23:49 
QuestionError converting data type nvarchar to datetime Pin
indian14321-Feb-18 12:13
memberindian14321-Feb-18 12:13 
AnswerRe: Error converting data type nvarchar to datetime Pin
Mycroft Holmes21-Feb-18 13:11
memberMycroft Holmes21-Feb-18 13:11 
AnswerRe: Error converting data type nvarchar to datetime Pin
Member 1226788921-Feb-18 20:21
memberMember 1226788921-Feb-18 20:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Cookies | Terms of Service
Web06 | 2.8.181207.3 | Last Updated 11 Dec 2018
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid