Forum Replies Created

Viewing 15 posts - 691 through 705 (of 1,473 total)

  • RE: SQL query help needed

    If you put it in the ON clause of a left join, it only joins that table where the criteria is met, but since it is a left join, your...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: possible to do in a case statement?

    Lynn Pettis (9/11/2009)


    I have to agree with Seth. there really isn't enough information in your post to really help you. If you could provide your code, DDL for...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: unpivot question

    Hrm, so they do. While that's unfortunate, due to the fact that you might be using Dynamic SQL anyways, this shouldn't be a major problem. You'll just add...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: unpivot question

    Can you post the unpivot code that generated this error? I'm pretty sure I specified the fields incorrectly the first couple times yesterday and got similar errors. As...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: possible to do in a case statement?

    thoughts, comments, suggestions?

    1. You appear to be using a table variable to do your running totals. You don't want to do this, because you can't establish a clustered...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: instead of trigger to fulfill need to delete table before data is inserted

    You should be able to make the trigger:

    A. Copy data matching your criteria(probably pulled from the inserted table to see what rows you're inserting) to your audit table.

    B. ...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: instead of trigger to fulfill need to delete table before data is inserted

    This is a duplicate post. No more responses here please. Respond to:

    http://www.sqlservercentral.com/Forums/Topic786113-338-1.aspx

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: T-SQL Stumper

    My immensely more confusing (but 2000 compliant) solution. I'm sure I could make this much less confusing and likely more efficient.

    DECLARE @a TABLE(

    NAMEVARCHAR(20),

    dateDATETIME,

    hoursINT,

    secondsBIGINT)

    insert INTO @a

    SELECT 'Sam', '09/10/2009...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: SQL query help needed

    Zaza (9/10/2009)


    I've tried adding

    and Tablename = 'SALE' in my query but if a sale does not have a memo, it will disregard the sale alltogether

    Thanks for your help though

    Are you...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: SQL query help needed

    select sid, people, amount, memo

    from sale left outer join memo

    on sid = parentid

    AND memo.TableName = 'SALE'

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: Select last non null values from a table

    ioan.ivanov (9/10/2009)


    This solution doesn't work because values from columns are not ordered except the column that store the timestamp.

    I knew reading these too quickly was gonna bite me eventually. ...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: Getting list of top "nodes"

    I believe the standard way for these hierarchies to work is something like:

    ID ParentID

    1

    2 1

    3 2

    4 1

    5 ...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: Querying on field with multi-values

    You basically need to parse or split the string to get the unique values out of it. You can do this in a number of ways. The tally...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: Select last non null values from a table

    SELECT MAX(col1) col1,MAX(col2) col2,MAX(col3) col3,MAX(col4) col4

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: Creating custom pivot-like output against 2 or more tables

    My pleasure. Take some time to get familiar with that piece and then post back once you start broadening it to meet your overall goal with any questions or...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

Viewing 15 posts - 691 through 705 (of 1,473 total)