Forum Replies Created

Viewing 12 posts - 1 through 13 (of 13 total)

  • RE: Find null values between 3 datasets, in one table

    You know, I've always known of CASE, but I've never found a way to implement it.

    This works perfectly! Thank you Luis Cazares!

  • RE: Query if ANY record between specific time

    Lynn Pettis (6/7/2013)


    tmac25 (6/7/2013)


    So, say I have a record where StartTime is '2013-06-07 13:00:00.000' and EndTime is '2013-06-07 13:02:00.000'

    Is there a way to have T-SQL select this record if I'm...

  • RE: Comparing 2 Tables, Joins with Specific Data

    Hello Chris!

    ID in skills tables are the foreign keys (I don't really have control over how this was designed) Users_Hierarchy works like this with the other tables:

    dbo.users_hierarchy.EMPLOYEEID = new_skills.id

    dbo.users_hierarchy.OLDID =...

  • RE: Assistance with this query

    Bump, still working at this. 🙂

    Thanks!

  • RE: Assistance with this query

    Hey Chris (or anyone!),

    Looks like I am have jumped the gun on my previous statement, as I'm having a bit of trouble with my new modified queries weeding out duplicate...

  • RE: Assistance with this query

    ChrisM@Work (3/26/2013)


    You will need to apply similar logic to all tables which have duplicate rows per employeeid. I'd guess that you need the most recent rows containing org.ORGANIZATIONID and job.JOBTITLEID....

  • RE: Assistance with this query

    Hello Chris!

    I apologize, I attempted to point this out in the original post, I see where I could have been more clear.

    The software that is being utilized all has ACTIONDATES/ACTIONORDER...

  • RE: Assistance with this query

    This is really odd, Chris. When I run that code, it runs quick and easy enough, however for some reason, it is duplicating ACTIONORDERS*

    *NOTE - I changed ACTIONDATE to ACTIONORDER...

  • RE: Assistance with this query

    ChrisM@Work (3/26/2013)


    ;WITH Employees AS (

    SELECT TOP 1

    employeeid,

    FIRSTNAME,

    LASTNAME,

    EMAILADDRESS,

    STARTDATE

    FROM linkedServer.linkedDB.dbo.AUEMPLOYEE

    WHERE employee.ENDDATE IS NULL -- still active

    ORDER BY ACTIONDATE DESC -- most recent

    )

    SELECT

    e.*,

    org.ORGANIZATIONID,

    job.JOBTITLEID

    FROM Employees...

  • RE: Assistance with this query

    Hey,

    Thanks for the reply.

    I'm receiving the follow error:

    Msg 8120, Level 16, State 1, Line 3

    Column 'linkedServer.linkedDB.dbo.AUEMPLOYEE.ACTIONDATE' is invalid in the select list because it is not contained in either an...

  • RE: Assistance with this query

    foxxo (3/25/2013)


    Try something like this

    SELECT employee.EMPLOYEEID, employee.FIRSTNAME, employee.LASTNAME, employee.STARTDATE, employee.EMAILADDRESS, org.ORGANIZATIONID, job.JOBTITLEID

    FROM dbo.AUEMPLOYEEJOBTITLE as job

    CROSS APPLY

    (SELECT TOP 1 emp.employeeid, emp.FIRSTNAME, emp.LASTNAME, emp.STARTDATE, emp.EMAILADDRESS, emp.ENDDATE

    ...

Viewing 12 posts - 1 through 13 (of 13 total)