Forum Replies Created

Viewing 15 posts - 1,606 through 1,620 (of 3,544 total)

  • RE: Grouping, eliminate un-matched pairs?

    quote...with the table I want all data from (a) on the left side of the '='...

    My preference is...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Insert into a Linked Server DB

    quotedon't think you can insert rows into a linked server using openquery statement.

    Yes you can

    From LnkSrv1

    INSERT INTO OPENQUERY(LnkSrv2,'SELECT...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: problem in restoring a new databse .

    As the error states, SQL can only restore from tape backups made using SQL BACKUP, your backup was done using NTBACKUP and hence the error.

    Use NTBACKUP to restore the backup...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Grouping, eliminate un-matched pairs?

    Yes, the left join is intentional.

    I used to find if there was a corresponding entry for the previous/following day with the oposite values. So for the data you posted each...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Grouping, eliminate un-matched pairs?

    This will work on the data given but any other alternative may not

    SELECT a.pid,a.dos,a.post,DATEDIFF(day,a.dos,a.post) AS [lag],a.part,SUM(a.volume),SUM(a.charges)

    FROM a

    LEFT JOIN b

    ON b.pid=a.pid

      AND b.dos=a.dos

      AND...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Question of the Day for 04 Apr 2007

    btw I agree with Hugo, none of the answers is correct.

    I did not answer when I realised this

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Question of the Day for 04 Apr 2007

    Also used by FTS on incremental catalog population.

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: SQL Query to join a column on a row

    One way

    SELECT c.[id],c.[name],c.[type],v.[value]

    FROM (SELECT [id], 'make' AS [name], [make] AS [value] FROM @veh UNION

    SELECT [id], 'model', [model] FROM @veh UNION

    SELECT [id], 'color', FROM @veh) v

    LEFT...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Need help in my Functions

    Why are you using functions to do simple calculations? Or is there more complex query that you have not given?

    You have a logic error in GetItemSoldCount. Whenever you use AND...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Getting information from two tables

    SELECT a.costcodeid,a.costcodedesc,b.combistatus

    FROM [coscodetable] a

    LEFT JOIN [tallycombi] b

    ON b.itemid = a.costcodeid

    and b.projectid = '999'

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: select query

    The last line

    ON e.EMPID = x.EMPID and AND l.Verify = 'N'

    has too many AND's and Verify should be referencing alies e not l, ie

    ON e.EMPID = x.EMPID AND

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: select query

    Use a CASE statement

    SELECT x.EMPID,COALESCE(a.[NAME],'') AS [NAME],

    CASE WHEN l.Verify = 'Y' THEN COALESCE(l.LICENSE,'') ELSE '' END AS [LICENSE],COALESCE(l.EMPLSTS,'') AS [EMPLSTS]

    FROM (SELECT @EMPID AS [EMPID]) x

    LEFT JOIN @HREMP_adp...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: select query

    Not sure what your question is but based on your last query

    a parameter of '11111' will return

    EMPID  NAME  LICENSE  EMPLSTS

    11111  ABC   NULL     NULL

    a parameter of '11112' will return

    EMPID  NAME  LICENSE ...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: select query

    Replace N'111111' with the parameter, eg @EMPID

    Add any further checks to the ON clause of the License JOIN, eg if the test for not expired is EXPIRED = 0

    then your...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: select query

    Sorry forgot to remove @ I used table variables to test query

    Should have been

    SELECT x.EMPID,COALESCE(a.[NAME],'') AS [NAME],COALESCE(l.LICENSE,'') AS [LICENSE]

    FROM (SELECT N'111111' AS [EMPID]) x

    LEFT JOIN HREMP_adp a...

    Far away is close at hand in the images of elsewhere.
    Anon.

Viewing 15 posts - 1,606 through 1,620 (of 3,544 total)