SQL QUERY

  • SELECT "TASKS"."HOURS", "TASKS"."WO_NUM", "TASKS"."DEPT_NUM", "TASKS"."REQUEST", "TASKS"."CLSDDATE", "STAF"."LOGIN", "TIUSER"."NTACCOUNT", "TASKS"."TASK"

    FROM ("TRACKIT_DATA"."dbo"."TASKS" "TASKS" INNER JOIN "TRACKIT_DATA"."dbo"."STAF" "STAF" ON "TASKS"."RESPONS"="STAF"."NAME") INNER JOIN

    "TRACKIT_DATA"."dbo"."TIUSER" "TIUSER" ON "TASKS"."REQUEST"="TIUSER"."FULLNAME" WHERE "TASKS"."HOURS">0 AND ("TASKS"."CLSDDATE">={ts '2010-10-20 00:00:00'} AND

    "TASKS"."CLSDDATE"<{ts '2010-11-06 00:00:00'})

    Thanks..:-P

  • Hi David,

    Sure, the tables used are:

    Database: TRACKIT_DATA

    Schema: dbo (that's the default)

    Tables: TASKS, STAF and TIUSER

  • Thanks a ton..

  • As a hint, the structure is:

    from

    inner join

    on [condition] inner join

    on [condition]

    The table naming is:

    server.database.schema.table

    Server, database, schema are optional, but are used to differentiate from other objects or because needed in a few situations, like Linked Servers or a separate location.

  • Again steve thanks a ton..

  • Sometimes, as was the case with your query, people put an alias after the server.database.schema.table construct. That's why you see "TASKS", "STAF" and "TIUSER" there twice in succession. Yours isn;t a great example but aliases can save typing later on. It's a way of having one (normally short) word refer to the whole thing.

  • Thanks SIR..

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply