Forum Replies Created

Viewing 15 posts - 121 through 135 (of 683 total)

  • RE: Using count with distinct on col with collation

    This works for me...

    declare @stores table (stor_name varchar(10))

    insert @stores

    select 'Simon'

    union all select 'Simon'

    union all select 'Simon'

    union all select 'Simon'

    union all...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Using count with distinct on col with collation

    simon.letts (5/8/2008)


    There are 10 occurences of this store but I want it broken down into how it really is ie Simon 4, simon 3, SIMON 4

    4 + 3 +...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: The "Numbers" or "Tally" Table: What it is and how it replaces a loop.

    Mark (5/7/2008)


    Jeff Marcus (5/7/2008)


    If you are using SQL Server 2005 you can use ROW_NUMBER instead.

    If you're not using SQL 2005, I guess you could simulate ROW_NUMBER like this...

    declare @param varchar(8000)

    set...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Column to Row

    David (5/7/2008)


    Thanks for the link to the article, I've not used either PIVOT or UNPIVOT before so I'm impressed with how easy it is to use. However, my query contains...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: How to use alias name ?

    shamshudheen (5/7/2008)


    Jeff,

    Who's Jeff?

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Column to Row

    Here's an article from the other day with some examples...

    http://weblogs.sqlteam.com/jeffs/archive/2008/04/23/unpivot.aspx

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Column to Row

    Piotr Rodak (5/7/2008)


    Look at the PIVOT command in BOL, this should do the job.

    Piotr

    UNPIVOT or UNION ALL might be more useful 🙂

    There are examples in BOL...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: select with pair of values

    mjschwenger (5/2/2008)


    This is exactly what I was looking for.

    How can I incorporated into a SP that will return also the result set?

    Thanks so much for the help,

    Tom

    Just like any other...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: The "Numbers" or "Tally" Table: What it is and how it replaces a loop.

    Nice work, Jeff. That plural table name must've been difficult for you to come to terms with 😀

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Filtering values from a Group By Statement

    No matter. Something like this...

    declare @tblcustomeraudit table (customerid int, forename varchar(20), surname varchar(20))

    insert @tblcustomeraudit

    select 1, 'John', 'Smith'

    union all select 1,...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Filtering values from a Group By Statement

    Is there a primary key or unique row identifier for the table?

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Everyones favourite 'Subquery returned more than 1 value'

    This all looks fine to me.

    Are there any lines like the following which don't contain an aggregation (like COUNT)?

    SET @Completed_Null_Urgency_INT = (SELECT COUNT(Order_Code) AS Count_INT

    The error...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Is XML the Answer?

    icocks (5/2/2008)


    can't be bothered

    Ian

    Laziness is the mother of invention :w00t:

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: select with pair of values

    I agree with Michael. This is the example I knocked up, but I was waiting for a reply. I also wanted to know if 'pairs' could have one of them...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: select with pair of values

    So what would be an example of the user inputs? Several pairs of product name and product type (potentially)?

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

Viewing 15 posts - 121 through 135 (of 683 total)