Forum Replies Created

Viewing 9 posts - 1 through 9 (of 9 total)

  • RE: Top N returning more than N records

    ChazMan (3/2/2011)


    Look at using the Rank() function and select a RanK() <= 3.

    Rank is not an option in the Filters -> Operator section. I need to be able to...

  • RE: Find orders with ALL the same items

    Dave Ballantyne (3/1/2011)


    Another option

    select Oid

    from orders

    group by oid

    having MAX(item) = MIN(item)

    and MIN(item) = '1063'

    This works but does not handle teh scenario where the item is null. In such a...

  • RE: Find orders with ALL the same items

    The query did not need to be as complex as you have asked. It was just to find orders that have ALL the same of item 1063. ColdCOffee...

  • RE: Find orders with ALL the same items

    ColdCoffee (3/1/2011)


    Try this:

    select *

    from orders outer_table

    where itemid = '1063'

    and not exists ( select 1 from orders inner_table

    ...

  • RE: Find orders with ALL the same items

    Craig Farrell (3/1/2011)


    insert into orders (oid, itemid)

    values (1,'1063')

    insert into orders (oid, itemid)

    values (1,'1063')

    insert into orders (oid, itemid)

    values (1,'1064')

    insert into orders (oid, itemid)

    values (2,'1063')

    insert into orders (oid, itemid)

    values (2,'1063')

    insert into orders...

  • RE: Convert rows to one column

    Thanks that worked great. Appreciate the tip on how to post. Will do that going forward.

  • RE: SQL Server Aggregation Query - Help needed

    Thanks Nagesh! That worked like a charm 😀

  • RE: SQL Server Aggregation Query - Help needed

    Hi

    I understand what you're saying completely. Did not mean to annoy anyone. I did understand the code, and I did add the date to the grouping clauses in...

  • RE: SQL Server Aggregation Query - Help needed

    Hi that worked great for the example i provided. If i add another requirement into the mix what would the SQL look like?

    SEQUENCE,PRODUCT,TIME,PRICE

    1,Spoon1,2010-05-05 08:30:00.000,83.50

    2,Spoon1,2010-05-05 08:31:01.000,80.00

    3,Spoon1,2010-05-05 08:32:02.000,81.00

    4,Spoon1,2010-05-05 08:33:03.000,82.00

    5,Fork1,2010-05-05 08:31:01.00,90.50

    6,Fork1,2010-05-05 08:32:02.000,90.00

    7,Fork1,2010-05-05...

Viewing 9 posts - 1 through 9 (of 9 total)