Fetching values under condition

  • Hi to all I have a Query which is fix like

    SELECT StudentId,EnrolmentId,SessionId,SchoolId, Name, ClassGroupId, ClassId, ClassName FROM ViewStudentTable WHERE IsBlock = 0 and sessionid=11 and schoolid=1 and classid=2

    I am searching student under session 11 schoolid 1 and classid 2

    Output is fine

    But now People searching student under session 11 and in schoolid=1

    I don't want to change query i wants that output should come with the same query

  • Once you prefer different outputs, obviously you need to change the filtering. But, i don't know what is the problem of changing the query..

    Regards,
    Karthik.
    SQL Developer.

  • goldyabk1 (9/8/2012)


    Hi to all I have a Query which is fix like

    SELECT StudentId,EnrolmentId,SessionId,SchoolId, Name, ClassGroupId, ClassId, ClassName FROM ViewStudentTable WHERE IsBlock = 0 and sessionid=11 and schoolid=1 and classid=2

    I am searching student under session 11 schoolid 1 and classid 2

    Output is fine

    But now People searching student under session 11 and in schoolid=1

    I don't want to change query i wants that output should come with the same query

    Create a stored procedure that contains the parameters you want to search for as variables.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • If you use stored procedure still you need to change the query. So, it is better to change the query directly. without changing the query you can't change the output.

  • Thanks

  • Thanks I got it

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply