You must Sign In to post a response.
  • Category: SQL Server

    SubQuery for SQL Server

    Hi,


    select client.GroupNumber from claim inner join client on Claim.[Group] = Client.GroupNumber LEFT OUTER JOIN Client AS Client_1 ON Claim.BackEndReporting = Client_1.GroupNumber

    WHERE (Claim.ClaimStatusCode = N'P') AND (Claim.AdjucationDate BETWEEN '01/01/2000'AND '02/02/2015')

    AND (Claim.FeeSchedule > 0) AND LEN(claim.[Group]) >6 and CLAIM.[GROUP] > (SELECT GroupNumber FROM client where GroupNumber = 'bm2081')


    I need help for this query

    In my table

    Calim.[Group] -Column
    ------------------
    BM2081
    BM2091P
    BM2081K
    BM2081C
    BM2081H


    Single Table and Single column only

    if i select BM2081 means i need to show all subGroup Data's and i need to show more that 6 letter's

    Like

    BM2091P
    BM2081K
    BM2081C
    BM2081H

    any one help pls


    Thanks
    Sriram.r
  • #765086
    Hi Sriram,

    little bit confused with your question but as per my understand the query " you need to get the records based on parent content", if your requirement is like that then use below sample format query


    select ct.GroupNumber
    from claim cm,
    client ct
    where cm.Id=ct.Id


    I assume that ID is the Primary and Foreign Key column in both the tables.

    --------------------------------------------------------------------------------
    Give respect to your work, Instead of trying to impress your boss.

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/

  • #765112
    Hi,
    Slight change in your script:
    select client.GroupNumber from claim inner join client on Claim.[Group] = Client.GroupNumber LEFT OUTER JOIN Client AS Client_1 ON Claim.BackEndReporting = Client_1.GroupNumber
    WHERE (Claim.ClaimStatusCode = N'P') AND (Claim.AdjucationDate BETWEEN '01/01/2000'AND '02/02/2015')
    AND (Claim.FeeSchedule > 0) AND LEN(claim.[Group]) > 6 and CLAIM.[GROUP] in (SELECT GroupNumber FROM client where GroupNumber like 'bm%')

    Hope it helps.
    Regards,
    Shashikant Gurav
    shashikantgurav22@gmail.com

  • #765161
    we are training institute present at chennai and provides you best solution for your queries. for more details visit our link,
    http://www.thinkittraining.in/seo


Sign In to post your comments