Forum Replies Created

Viewing 15 posts - 601 through 615 (of 683 total)

  • RE: Derived tables - is there a more elegant way.

    Scorpion - Have you been drinking?

    Allen - Nicely written question   You've done this exactly how...

  • RE: Hierachy Sort (with a twist)

    You mean "Joe Celko's Trees and Hierarchies in SQL for Smarties"?

    Shame on you Joe!

  • RE: Subquey or #temp

    Just use a case statement

    Something like...

    select isnull(p1.dep_number, p2.dep_number) as dep_number, TurnW1, TurnW2,

           case when...

  • RE: Update error

    Check the triggers of that table...

  • RE: select

    You can do this too...

    SELECT ISNULL(address2, address1) AS Result FROM tablename

    Or...

    SELECT COALESCE(address2, address1) AS Result FROM tablename

  • RE: SELECT MIN Rank

    Hi All,

    Matt - you're not just looking for this, are you?

    select ProjectID, min(User_Rank) as User_Rank from Myview Group by ProjectID

  • RE: problem in a query

    You'll need to do something like this...

    select a.*, commentcount

    from tbl_UserBlog a

      inner join (select UserBlogID, count(*) as commentcount From tbl_Comments group by UserBlogID) b

        on a.UserBlogID...

  • RE: HOW TO TRANSPOSE COLUMNS TO ROWS USING T-SQL

    You'll be needing a UNION:

    DECLARE @t TABLE (dssid1 VARCHAR(3), dssid2 VARCHAR(3), dssid3 VARCHAR(3), name1 VARCHAR(20), name2 VARCHAR(20), name3 VARCHAR(20))

    INSERT INTO @t

          SELECT '001', '003',...

  • RE: Hierachy Sort (with a twist)

    Thanks Junkie

    I don't think you'll need to do anything dynamically - if 8 levels is your max, just extend it as below, and...

  • RE: Subquey or #temp

    Hi Jean-Pierre,

    I'd probably do something like this (so a bit of a combination of the two techniques )...

    Good luck!

    --This SQL...

  • RE: Join

    Hi Tracey, Jeff

    Just for fun, here's a different way (although similar, I admit) 

    I think it's not possible without a loop if the depth...

  • RE: Hierachy Sort (with a twist)

    Ignoring the fact that you probably ought to think some more about your data structure , this query below does the trick (I think)...

  • RE: Hierachy Sort (with a twist)

    Maybe I'm missing something, but why is 7264;20433;17886 (Level 2, TableSort 2) above 7264;20433;40264 (Level 2, TableSort 1)?

  • RE: XML Child - Parent Relationship

    I was more meaning that you had the 1, 2 and 3 in the wrong order (or so it seemed), rather than the output, but no matter.

  • RE: Complex function

    No problem James - solving problems like this is fun!

    I don't know anything about Sybase though - sorry

Viewing 15 posts - 601 through 615 (of 683 total)