Forum Replies Created

Viewing 5 posts - 151 through 155 (of 155 total)

  • RE: Find Min/Max Values in a Set

    Adrian,

    Your solution would be more elegant indeed, but it doesn't work.

    Unfortunately, the TOP keyword accepts only a constant, not a variable.

    Dinesh,

    Indeed, I would not add an index to a Qty...

  • RE: Find Min/Max Values in a Set

    Here are two shorter queries that do the same thing as your queries:

    select distinct (select count(distinct number) from nMaxMin s2 where

    s2.number<=s1.number) as rank, number from nMaxMin s1 order by 1

    select...

  • RE: When's Your Anniversary

    Here is one using only DAY(), MONTH() AND YEAR() functions:

    SELECT * FROM MyTest WHERE

    year(@today)=year(@lastday) and month(@today)<month(@lastday) and

    ( month(birthday)>month(@today) and month(birthday)<month(@lastday)

    or month(birthday)=month(@today) and day(birthday)>=day(@today)

    or month(birthday)=month(@lastday)...

  • RE: Cluster That Index!

    quote:


    Great article. One disadvantage to a clustered index that I hear a lot of people claim is disk space. How...

  • RE: UDF's vs. SP's and optimization

    quote:


    However, if you use the function:

    [...]

    And then the select:

    select * from lef(123456,123456,'LUN')

    It uses the same index as the first...

Viewing 5 posts - 151 through 155 (of 155 total)