troubleshooting Question

DB2 issue with assinging TableName on a select statement, How to?

Avatar of rhservan
rhservanFlag for United States of America asked on
Microsoft SQL ServerDB2SQL
7 Comments1 Solution732 ViewsLast Modified:
FYI: Here is the complete YTD Sproc in MSSQL Format

The attached sproc works correctly in the in the micorsoft environment and is derived from there.

I need to convert this to a DB2 Sproc. I have an immediate concern now and will be asking additional new questions.  The issue revolves around empcount & NumEmployees.

empcount is a derived table from a select statement I cannot make this work in DB2 environment.  Please provide a solution that will work.

Here is the text of the section in which the empcount is created:
(This info is marked in yellow highlighter where it applies in the attachment)

INNER JOIN (
            SELECT
                  HirePosition, COUNT(EmpID) AS NumEmployees
            FROM
                  dbo.tbl_LuRt_Employee
            WHERE
                  TermDate IS NULL
                  AND Salary >= 100
            GROUP BY
                  HirePosition) empcount
      ON e.HirePosition = empcount.HirePosition
sproc---YTD---mssqlformat.docx
ASKER CERTIFIED SOLUTION
Kent Olsen
Data Warehouse / Database Architect

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros