Forum Replies Created

Viewing 15 posts - 226 through 240 (of 761 total)

  • RE: assigning a number or step to a sequence that restarts within a result set

    Does that really work Ayesha??...Did you check? 😛

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

  • RE: assigning a number or step to a sequence that restarts within a result set

    That is a very nice query ColdCoffee. Great job with the Partitions.

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

  • RE: Help Needed in Split Column

    Use the Splitter as a function and Cross Apply on the Table to get the desired results. Post DDL and Sample data for a working example.

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

  • RE: Combining multiple rows to single row

    There are many ways to do it. Here are a few....you can choose which one to use depending upon your requirement:

    --Creating Table

    Create Table Ex

    (PID int,

    ID int,

    FileName Varchar(10),...

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

  • RE: Need assistance with converting [0..n] to [1..1] for a view

    This is a little simpler but on the same lines as ColCoffee:

    --===== Create the temporary test table #TABLE1 with

    CREATE TABLE TABLE1 (

    PK INT PRIMARY KEY,

    Class NVARCHAR(2)

    );

    --===== Create the temporary...

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

  • RE: Hierarchy/Tree Structure Query

    Thank you very much G.

    I'll Google both types of Hierarchies.

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

  • RE: Hierarchy/Tree Structure Query

    Yes, you may be correct.

    This is just tailor made to fit my requirement. But, its good that you have brought it to my notice.

    Can you post a sample data set...

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

  • RE: Hierarchy/Tree Structure Query

    Well, no answers yet.

    But, I've got good news. I solved it using Recursive CTE. This is the solution:

    Declare @loginId int = 2

    ;With CTE

    As

    (

    --Anchor Member Definition

    Select EmpId From Hierarchy_Test Where SupervisorId...

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

  • RE: Hierarchy/Tree Structure Query

    Well, no answers yet.

    But, I've got good news. I solved it using Recursive CTE. This is the solution:

    Declare @loginId int = 2

    ;With CTE

    As

    (

    --Anchor Member Definition

    Select EmpId From Hierarchy_Test Where SupervisorId...

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

  • RE: SELECTing DISTINCT values in CASE pivot?

    DataAnalyst110 (7/3/2012)


    Hi Vinu - Thanks for your reply. What is the simpler query? To put make the cte a subquery in the from clause? That is the only thing I...

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

  • RE: Month with Zero Value Using Case

    Sorry, for the late reply.

    You can create a Calender Table and JOIN the Calender Table with the Table "MetricValues" to get the Desired Output as follows:

    --Creating Table

    Create Table MetricValues (...

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

  • RE: combining data in diff rows with linebreak into single

    David Webb-200187 (6/29/2012)


    I always learn something new every time I try one of these.

    Thanks for jumping in, Lynn.

    Had a syntax error on the select, but this runs:

    SELECT ...

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

  • RE: SELECTing DISTINCT values in CASE pivot?

    This could be another way of doing it:

    Select Activity, COUNT(Activity) As Fees

    From

    (Select *, ROW_NUMBER() Over (Partition By Stud_Id, Activity Order By Stud_Id) As rn From TestingCase_Act) As a

    Where rn...

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

  • RE: Crosstabing AVG and checking with CASE

    How about making it a little simple by avoiding all those CTEs like this:

    CREATE TABLE PVT_AVG

    (

    Stu_IDCHAR(10)NOT NULL,

    Adm_ExamCHAR(25)NOT NULL,

    Adm_Exam_DateDateNOT NULL,

    Adm_Exam_ScoreCHAR(6)NOT NULL

    )

    INSERT INTO PVT_AVG

    (

    Stu_ID,

    Adm_Exam,

    Adm_Exam_Date,

    Adm_Exam_Score

    )

    VALUES

    ('123456', 'Adm_MCT', '2009-01-01', '21'),

    ('123456', 'Adm_MCT', '2010-03-01', '23'),

    ('987654', 'Adm_GPA', '2008-04-15',...

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

  • RE: Presenting rows of data horizontally

    It can be done in a no. of ways depending on whether the no. of columns in the query would be static or Dynamic. Following are a few ways of...

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

Viewing 15 posts - 226 through 240 (of 761 total)