Solved

Union Joins

Posted on 2012-04-04
11
237 Views
Last Modified: 2012-04-17
I have three unions [1011], [1011], [1112].

With the unions you need to have the same numhber of rows in each select, which is fine.

The additional select in each union is      
,[Primary Diagnosis Code],LEFT([Primary Diagnosis Code],5) AS PRIMARY_DIAGNOSIS_ICD10,ICD_PRIM_DIAG.ICD104NM AS PRIMARY_DIAGNOSIS_DESC

But my question is I only want to do the joins on the last union. But this causes a problem because Msg 4104, Level 16, State 1, Line 119
The multi-part identifier "ICD_PRIM_DIAG.ICD104NM" could not be bound.
Msg 4104, Level 16, State 1, Line 279
The multi-part identifier "ICD_PRIM_DIAG.ICD104NM" could not be bound.

Which means the join need to be in each union.



SELECT

     
      [Primary Diagnosis Code]
      ,LEFT([Primary Diagnosis Code],5) AS PRIMARY_DIAGNOSIS_ICD10
        ,ICD_PRIM_DIAG.ICD104NM AS PRIMARY_DIAGNOSIS_DESC
     
      ,[Secondary Diagnosis Code 1]
      ,[Secondary Diagnosis Code 2]
      ,[Secondary Diagnosis Code 3]
      ,[Secondary Diagnosis Code 4]


           
FROM  [0910]


      UNION ALL

     
SELECT  

     
      [Primary Diagnosis Code]
      ,LEFT([Primary Diagnosis Code],5) AS PRIMARY_DIAGNOSIS_ICD10
        ,ICD_PRIM_DIAG.ICD104NM AS PRIMARY_DIAGNOSIS_DESC
     
      ,[Secondary Diagnosis Code 1]
      ,[Secondary Diagnosis Code 2]
      ,[Secondary Diagnosis Code 3]
      ,[Secondary Diagnosis Code 4]

     
FROM [1011]

      UNION ALL

SELECT

      [Primary Diagnosis Code]
      ,LEFT([Primary Diagnosis Code],5) AS PRIMARY_DIAGNOSIS_ICD10
        ,ICD_PRIM_DIAG.ICD104NM AS PRIMARY_DIAGNOSIS_DESC
     
     
      ,[Secondary Diagnosis Code 1]
      ,[Secondary Diagnosis Code 2]
      ,[Secondary Diagnosis Code 3]
      ,[Secondary Diagnosis Code 4]
 
 
     
FROM      [1112]

                  LEFT OUTER JOIN
            [LookUp].[dbo].[tbl_ICD10] AS ICD_PRIM_DIAG
                  ON ICD_PRIM_DIAG.ICD104CD = LEFT([Primary Diagnosis Code],4)

                  LEFT OUTER JOIN
            [LookUp].[dbo].[tbl_ICD10] AS ICD_SEC1_DIAG
                  ON ICD_SEC1_DIAG.ICD104CD = [Secondary Diagnosis Code 1]

                  LEFT OUTER JOIN
            [LookUp].[dbo].[tbl_ICD10] AS ICD_SEC2_DIAG
                  ON ICD_SEC2_DIAG.ICD104CD = [Secondary Diagnosis Code 2]

                  LEFT OUTER JOIN
            [LookUp].[dbo].[tbl_ICD10] AS ICD_SEC3_DIAG
                  ON ICD_SEC3_DIAG.ICD104CD = [Secondary Diagnosis Code 3]

                  LEFT OUTER JOIN
            [LookUp].[dbo].[tbl_ICD10] AS ICD_SEC4_DIAG
                  ON ICD_SEC4_DIAG.ICD104CD = [Secondary Diagnosis Code 4]


GO
0
Comment
Question by:aneilg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
11 Comments
 
LVL 6

Expert Comment

by:ingriT
ID: 37805012
Try using the UNION keyword instead of the UNION ALL keyword.
0
 
LVL 15

Accepted Solution

by:
gplana earned 325 total points
ID: 37805035
ingriT: UNION eliminates duplicates and UNION ALL don't. So I don't think the solution is to change UNION ALL by UNIONs.

aneilg: All SELECTs should have the same number of columns, and the same datatype on every column, but every select can have a different number of rows, no problem on this.

I'm not understanding the problem: it looks like ICD_PRIM_DIAG.ICD104NM field is on one of the join tables, so if you want this field on a select you need to join to this table. If you don't want this column on a select, just replace it by a value that matches the datatype of this field. For example, if this field is a text based field, you can do something like this:

SELECT

     
      [Primary Diagnosis Code]
      ,LEFT([Primary Diagnosis Code],5) AS PRIMARY_DIAGNOSIS_ICD10
        ,ICD_PRIM_DIAG.ICD104NM AS PRIMARY_DIAGNOSIS_DESC
     
      ,[Secondary Diagnosis Code 1]
      ,[Secondary Diagnosis Code 2]
      ,[Secondary Diagnosis Code 3]
      ,[Secondary Diagnosis Code 4]


           
FROM  [0910]


      UNION ALL

     
SELECT  

     
      [Primary Diagnosis Code]
      ,LEFT([Primary Diagnosis Code],5) AS PRIMARY_DIAGNOSIS_ICD10
        ,'' AS PRIMARY_DIAGNOSIS_DESC
     
      ,[Secondary Diagnosis Code 1]
      ,[Secondary Diagnosis Code 2]
      ,[Secondary Diagnosis Code 3]
      ,[Secondary Diagnosis Code 4]

     
FROM [1011]

      UNION ALL

SELECT

      [Primary Diagnosis Code]
      ,LEFT([Primary Diagnosis Code],5) AS PRIMARY_DIAGNOSIS_ICD10
        ,'' AS PRIMARY_DIAGNOSIS_DESC
     
     
      ,[Secondary Diagnosis Code 1]
      ,[Secondary Diagnosis Code 2]
      ,[Secondary Diagnosis Code 3]
      ,[Secondary Diagnosis Code 4]
 
 
     
FROM      [1112]

                  LEFT OUTER JOIN
            [LookUp].[dbo].[tbl_ICD10] AS ICD_PRIM_DIAG
                  ON ICD_PRIM_DIAG.ICD104CD = LEFT([Primary Diagnosis Code],4)

                  LEFT OUTER JOIN
            [LookUp].[dbo].[tbl_ICD10] AS ICD_SEC1_DIAG
                  ON ICD_SEC1_DIAG.ICD104CD = [Secondary Diagnosis Code 1]

                  LEFT OUTER JOIN
            [LookUp].[dbo].[tbl_ICD10] AS ICD_SEC2_DIAG
                  ON ICD_SEC2_DIAG.ICD104CD = [Secondary Diagnosis Code 2]

                  LEFT OUTER JOIN
            [LookUp].[dbo].[tbl_ICD10] AS ICD_SEC3_DIAG
                  ON ICD_SEC3_DIAG.ICD104CD = [Secondary Diagnosis Code 3]

                  LEFT OUTER JOIN
            [LookUp].[dbo].[tbl_ICD10] AS ICD_SEC4_DIAG
                  ON ICD_SEC4_DIAG.ICD104CD = [Secondary Diagnosis Code 4]


GO

Open in new window


Hope it helps
0
 

Author Comment

by:aneilg
ID: 37805264
this is an example of the select working.

my question is, is it possible not to have the joins in each union, only having the join on [1112]. but the problem is

Msg 4104, Level 16, State 1, Line 119
The multi-part identifier "ICD_PRIM_DIAG.ICD104NM" could not be bound.
ect.

the query as it stands need the joins in each union. is it possible to only have the join on
the last query

SELECT

      ,[Primary Diagnosis Code]
      ,LEFT([Primary Diagnosis Code],5) AS PRIMARY_DIAGNOSIS_ICD10
        ,ICD_PRIM_DIAG.ICD104NM AS PRIMARY_DIAGNOSIS_DESC
     
      ,[Secondary Diagnosis Code 1]
      ,LEFT([Secondary Diagnosis Code 1],5) AS [1ST_SEC_DIAGNOSIS_ICD10]
        ,ICD_SEC1_DIAG.ICD104NM AS SEC_DIAG1ST_DESC
     
      ,[Secondary Diagnosis Code 2]
      ,LEFT([Secondary Diagnosis Code 2],5) AS [2ND_SEC_DIAGNOSIS_ICD10]
        ,ICD_SEC2_DIAG.ICD104NM AS SEC_DIAG2ND_DESC
     
      ,[Secondary Diagnosis Code 3]
      ,left([Secondary Diagnosis Code 3],5) AS [3RD_SEC_DIAGNOSIS_ICD10]
        ,ICD_SEC3_DIAG.ICD104NM AS SEC_DIAG3RD_DESC
     
      ,[Secondary Diagnosis Code 4]
      ,left([Secondary Diagnosis Code 4],5) AS [4TH_SEC_DIAGNOSIS_ICD10]
        ,ICD_SEC4_DIAG.ICD104NM AS SEC_DIAG4TH_DESC
     

            
FROM  [0910]

            --      LEFT OUTER JOIN
            --[LookUp].[dbo].[tbl_ICD10] AS ICD_PRIM_DIAG
            --      ON ICD_PRIM_DIAG.ICD104CD = LEFT([Primary Diagnosis Code],4)

            --      LEFT OUTER JOIN
            --[LookUp].[dbo].[tbl_ICD10] AS ICD_SEC1_DIAG
            --      ON ICD_SEC1_DIAG.ICD104CD = [Secondary Diagnosis Code 1]

            --      LEFT OUTER JOIN
            --[LookUp].[dbo].[tbl_ICD10] AS ICD_SEC2_DIAG
            --      ON ICD_SEC2_DIAG.ICD104CD = [Secondary Diagnosis Code 2]

            --      LEFT OUTER JOIN
            --[LookUp].[dbo].[tbl_ICD10] AS ICD_SEC3_DIAG
            --      ON ICD_SEC3_DIAG.ICD104CD = [Secondary Diagnosis Code 3]

            --      LEFT OUTER JOIN
            --[LookUp].[dbo].[tbl_ICD10] AS ICD_SEC4_DIAG
            --      ON ICD_SEC4_DIAG.ICD104CD = [Secondary Diagnosis Code 4]

      UNION

      
SELECT  

     
      ,[Primary Diagnosis Code]
      ,LEFT([Primary Diagnosis Code],5) AS PRIMARY_DIAGNOSIS_ICD10
        ,ICD_PRIM_DIAG.ICD104NM AS PRIMARY_DIAGNOSIS_DESC
     
      ,[Secondary Diagnosis Code 1]
      ,LEFT([Secondary Diagnosis Code 1],5) AS [1ST_SEC_DIAGNOSIS_ICD10]
        ,ICD_SEC1_DIAG.ICD104NM AS SEC_DIAG1ST_DESC
     
      ,[Secondary Diagnosis Code 2]
      ,LEFT([Secondary Diagnosis Code 2],5) AS [2ND_SEC_DIAGNOSIS_ICD10]
        ,ICD_SEC2_DIAG.ICD104NM AS SEC_DIAG2ND_DESC
     
      ,[Secondary Diagnosis Code 3]
      ,left([Secondary Diagnosis Code 3],5) AS [3RD_SEC_DIAGNOSIS_ICD10]
        ,ICD_SEC3_DIAG.ICD104NM AS SEC_DIAG3RD_DESC
     
      ,[Secondary Diagnosis Code 4]
      ,left([Secondary Diagnosis Code 4],5) AS [4TH_SEC_DIAGNOSIS_ICD10]
        ,ICD_SEC4_DIAG.ICD104NM AS SEC_DIAG4TH_DESC
     

      
      
FROM [1011]

            --      LEFT OUTER JOIN
            --[LookUp].[dbo].[tbl_ICD10] AS ICD_PRIM_DIAG
            --      ON ICD_PRIM_DIAG.ICD104CD = LEFT([Primary Diagnosis Code],4)

            --      LEFT OUTER JOIN
            --[LookUp].[dbo].[tbl_ICD10] AS ICD_SEC1_DIAG
            --      ON ICD_SEC1_DIAG.ICD104CD = [Secondary Diagnosis Code 1]

            --      LEFT OUTER JOIN
            --[LookUp].[dbo].[tbl_ICD10] AS ICD_SEC2_DIAG
            --      ON ICD_SEC2_DIAG.ICD104CD = [Secondary Diagnosis Code 2]

            --      LEFT OUTER JOIN
            --[LookUp].[dbo].[tbl_ICD10] AS ICD_SEC3_DIAG
            --      ON ICD_SEC3_DIAG.ICD104CD = [Secondary Diagnosis Code 3]

            --      LEFT OUTER JOIN
            --[LookUp].[dbo].[tbl_ICD10] AS ICD_SEC4_DIAG
            --      ON ICD_SEC4_DIAG.ICD104CD = [Secondary Diagnosis Code 4]


      UNION

SELECT



      ,[Primary Diagnosis Code]
      ,LEFT([Primary Diagnosis Code],5) AS PRIMARY_DIAGNOSIS_ICD10
        ,ICD_PRIM_DIAG.ICD104NM AS PRIMARY_DIAGNOSIS_DESC

      ,[Secondary Diagnosis Code 1]
      ,LEFT([Secondary Diagnosis Code 1],5) AS [1ST_SEC_DIAGNOSIS_ICD10]
        ,ICD_SEC1_DIAG.ICD104NM AS SEC_DIAG1ST_DESC
     
      ,[Secondary Diagnosis Code 2]
      ,LEFT([Secondary Diagnosis Code 2],5) AS [2ND_SEC_DIAGNOSIS_ICD10]
        ,ICD_SEC2_DIAG.ICD104NM AS SEC_DIAG2ND_DESC
     
      ,[Secondary Diagnosis Code 3]
      ,left([Secondary Diagnosis Code 3],5) AS [3RD_SEC_DIAGNOSIS_ICD10]
        ,ICD_SEC3_DIAG.ICD104NM AS SEC_DIAG3RD_DESC
     
      ,[Secondary Diagnosis Code 4]
      ,left([Secondary Diagnosis Code 4],5) AS [4TH_SEC_DIAGNOSIS_ICD10]
        ,ICD_SEC4_DIAG.ICD104NM AS SEC_DIAG4TH_DESC
     

      
FROM      [1112]

                  LEFT OUTER JOIN
            [LookUp].[dbo].[tbl_ICD10] AS ICD_PRIM_DIAG
                  ON ICD_PRIM_DIAG.ICD104CD = LEFT([Primary Diagnosis Code],4)

                  LEFT OUTER JOIN
            [LookUp].[dbo].[tbl_ICD10] AS ICD_SEC1_DIAG
                  ON ICD_SEC1_DIAG.ICD104CD = [Secondary Diagnosis Code 1]

                  LEFT OUTER JOIN
            [LookUp].[dbo].[tbl_ICD10] AS ICD_SEC2_DIAG
                  ON ICD_SEC2_DIAG.ICD104CD = [Secondary Diagnosis Code 2]

                  LEFT OUTER JOIN
            [LookUp].[dbo].[tbl_ICD10] AS ICD_SEC3_DIAG
                  ON ICD_SEC3_DIAG.ICD104CD = [Secondary Diagnosis Code 3]

                  LEFT OUTER JOIN
            [LookUp].[dbo].[tbl_ICD10] AS ICD_SEC4_DIAG
                  ON ICD_SEC4_DIAG.ICD104CD = [Secondary Diagnosis Code 4]
0
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 
LVL 15

Expert Comment

by:gplana
ID: 37805484
Yes, just try to remove joins now, as I have replaced the field by an empty string on the select.
0
 

Author Comment

by:aneilg
ID: 37805497
ok i'll give it a go.

i was told this approcah is possible.
Select fieldNames from (

10/11 query

Union all

11/12 query

) as subQuery
Then do all the joins here
0
 
LVL 15

Expert Comment

by:gplana
ID: 37805561
Yes, this is also possible, but isn't it better the solution I give ?

Or maybe I misunderstood the goal ?
0
 

Author Comment

by:aneilg
ID: 37805578
yeah but he is Adamant I do it his way.


but if i do

SELECT * FROM (

SELECT

      ,[Primary Diagnosis Code]
      ,LEFT([Primary Diagnosis Code],5) AS PRIMARY_DIAGNOSIS_ICD10
        ,ICD_PRIM_DIAG.ICD104NM AS PRIMARY_DIAGNOSIS_DESC
     
      ,[Secondary Diagnosis Code 1]
      ,LEFT([Secondary Diagnosis Code 1],5) AS [1ST_SEC_DIAGNOSIS_ICD10]
        ,ICD_SEC1_DIAG.ICD104NM AS SEC_DIAG1ST_DESC
     
      ,[Secondary Diagnosis Code 2]
      ,LEFT([Secondary Diagnosis Code 2],5) AS [2ND_SEC_DIAGNOSIS_ICD10]
        ,ICD_SEC2_DIAG.ICD104NM AS SEC_DIAG2ND_DESC
     
      ,[Secondary Diagnosis Code 3]
      ,left([Secondary Diagnosis Code 3],5) AS [3RD_SEC_DIAGNOSIS_ICD10]
        ,ICD_SEC3_DIAG.ICD104NM AS SEC_DIAG3RD_DESC
     
      ,[Secondary Diagnosis Code 4]
      ,left([Secondary Diagnosis Code 4],5) AS [4TH_SEC_DIAGNOSIS_ICD10]
        ,ICD_SEC4_DIAG.ICD104NM AS SEC_DIAG4TH_DESC
     

           
FROM  [0910]

            --      LEFT OUTER JOIN
            --[LookUp].[dbo].[tbl_ICD10] AS ICD_PRIM_DIAG
            --      ON ICD_PRIM_DIAG.ICD104CD = LEFT([Primary Diagnosis Code],4)

            --      LEFT OUTER JOIN
            --[LookUp].[dbo].[tbl_ICD10] AS ICD_SEC1_DIAG
            --      ON ICD_SEC1_DIAG.ICD104CD = [Secondary Diagnosis Code 1]

            --      LEFT OUTER JOIN
            --[LookUp].[dbo].[tbl_ICD10] AS ICD_SEC2_DIAG
            --      ON ICD_SEC2_DIAG.ICD104CD = [Secondary Diagnosis Code 2]

            --      LEFT OUTER JOIN
            --[LookUp].[dbo].[tbl_ICD10] AS ICD_SEC3_DIAG
            --      ON ICD_SEC3_DIAG.ICD104CD = [Secondary Diagnosis Code 3]

            --      LEFT OUTER JOIN
            --[LookUp].[dbo].[tbl_ICD10] AS ICD_SEC4_DIAG
            --      ON ICD_SEC4_DIAG.ICD104CD = [Secondary Diagnosis Code 4]

      UNION

     
SELECT  

     
      ,[Primary Diagnosis Code]
      ,LEFT([Primary Diagnosis Code],5) AS PRIMARY_DIAGNOSIS_ICD10
        ,ICD_PRIM_DIAG.ICD104NM AS PRIMARY_DIAGNOSIS_DESC
     
      ,[Secondary Diagnosis Code 1]
      ,LEFT([Secondary Diagnosis Code 1],5) AS [1ST_SEC_DIAGNOSIS_ICD10]
        ,ICD_SEC1_DIAG.ICD104NM AS SEC_DIAG1ST_DESC
     
      ,[Secondary Diagnosis Code 2]
      ,LEFT([Secondary Diagnosis Code 2],5) AS [2ND_SEC_DIAGNOSIS_ICD10]
        ,ICD_SEC2_DIAG.ICD104NM AS SEC_DIAG2ND_DESC
     
      ,[Secondary Diagnosis Code 3]
      ,left([Secondary Diagnosis Code 3],5) AS [3RD_SEC_DIAGNOSIS_ICD10]
        ,ICD_SEC3_DIAG.ICD104NM AS SEC_DIAG3RD_DESC
     
      ,[Secondary Diagnosis Code 4]
      ,left([Secondary Diagnosis Code 4],5) AS [4TH_SEC_DIAGNOSIS_ICD10]
        ,ICD_SEC4_DIAG.ICD104NM AS SEC_DIAG4TH_DESC
     

     
     
FROM [1011]

            --      LEFT OUTER JOIN
            --[LookUp].[dbo].[tbl_ICD10] AS ICD_PRIM_DIAG
            --      ON ICD_PRIM_DIAG.ICD104CD = LEFT([Primary Diagnosis Code],4)

            --      LEFT OUTER JOIN
            --[LookUp].[dbo].[tbl_ICD10] AS ICD_SEC1_DIAG
            --      ON ICD_SEC1_DIAG.ICD104CD = [Secondary Diagnosis Code 1]

            --      LEFT OUTER JOIN
            --[LookUp].[dbo].[tbl_ICD10] AS ICD_SEC2_DIAG
            --      ON ICD_SEC2_DIAG.ICD104CD = [Secondary Diagnosis Code 2]

            --      LEFT OUTER JOIN
            --[LookUp].[dbo].[tbl_ICD10] AS ICD_SEC3_DIAG
            --      ON ICD_SEC3_DIAG.ICD104CD = [Secondary Diagnosis Code 3]

            --      LEFT OUTER JOIN
            --[LookUp].[dbo].[tbl_ICD10] AS ICD_SEC4_DIAG
            --      ON ICD_SEC4_DIAG.ICD104CD = [Secondary Diagnosis Code 4]


      UNION

SELECT



      ,[Primary Diagnosis Code]
      ,LEFT([Primary Diagnosis Code],5) AS PRIMARY_DIAGNOSIS_ICD10
        ,ICD_PRIM_DIAG.ICD104NM AS PRIMARY_DIAGNOSIS_DESC

      ,[Secondary Diagnosis Code 1]
      ,LEFT([Secondary Diagnosis Code 1],5) AS [1ST_SEC_DIAGNOSIS_ICD10]
        ,ICD_SEC1_DIAG.ICD104NM AS SEC_DIAG1ST_DESC
     
      ,[Secondary Diagnosis Code 2]
      ,LEFT([Secondary Diagnosis Code 2],5) AS [2ND_SEC_DIAGNOSIS_ICD10]
        ,ICD_SEC2_DIAG.ICD104NM AS SEC_DIAG2ND_DESC
     
      ,[Secondary Diagnosis Code 3]
      ,left([Secondary Diagnosis Code 3],5) AS [3RD_SEC_DIAGNOSIS_ICD10]
        ,ICD_SEC3_DIAG.ICD104NM AS SEC_DIAG3RD_DESC
     
      ,[Secondary Diagnosis Code 4]
      ,left([Secondary Diagnosis Code 4],5) AS [4TH_SEC_DIAGNOSIS_ICD10]
        ,ICD_SEC4_DIAG.ICD104NM AS SEC_DIAG4TH_DESC
     

     
FROM      [1112]

) as g


                  LEFT OUTER JOIN
            [LookUp].[dbo].[tbl_ICD10] AS ICD_PRIM_DIAG
                  ON ICD_PRIM_DIAG.ICD104CD = LEFT([Primary Diagnosis Code],4)

                  LEFT OUTER JOIN
            [LookUp].[dbo].[tbl_ICD10] AS ICD_SEC1_DIAG
                  ON ICD_SEC1_DIAG.ICD104CD = [Secondary Diagnosis Code 1]

                  LEFT OUTER JOIN
            [LookUp].[dbo].[tbl_ICD10] AS ICD_SEC2_DIAG
                  ON ICD_SEC2_DIAG.ICD104CD = [Secondary Diagnosis Code 2]

                  LEFT OUTER JOIN
            [LookUp].[dbo].[tbl_ICD10] AS ICD_SEC3_DIAG
                  ON ICD_SEC3_DIAG.ICD104CD = [Secondary Diagnosis Code 3]

                  LEFT OUTER JOIN
            [LookUp].[dbo].[tbl_ICD10] AS ICD_SEC4_DIAG
                  ON ICD_SEC4_DIAG.ICD104CD = [Secondary Diagnosis Code 4]


i get Msg 4104, Level 16, State 1, Line 121
The multi-part identifier "ICD_PRIM_DIAG.ICD104NM" could not be bound.
0
 
LVL 15

Expert Comment

by:gplana
ID: 37805600
Ok, in this case try the other approach:

SELECT .... FROM (
                 SELECT ... (without joins)
                 UNION ALL
                 SELECT ... (without joins)
                 UNION ALL
                 SELECT ... (without joins)
) and make the joins here
0
 

Author Comment

by:aneilg
ID: 37805652
thanks for your help,

i've done

SELECT * FROM (

) as g

joins

but get Msg 4104, Level 16, State 1, Line 121
The multi-part identifier "ICD_PRIM_DIAG.ICD104NM" could not be bound.
Msg 4104, Level 16, State 1, Line 125

is this appracah possible.
0
 
LVL 15

Expert Comment

by:gplana
ID: 37805834
This is because you don't have the ICD_PRIM_DIAG table on your SELECT or because field ICD104NM is not a valid field on ICD_PRIM_DIAG table
0
 

Author Closing Comment

by:aneilg
ID: 37855755
thanks.
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question