Stored Procedure

  • Hello Guys, Need a small help. Im a bit confused.

    I have a Table :

    ID

    DATE

    YEAR

    CLASS_ID

    STATUS

    Class Table : Class_ID and Classroom

    I am working on ASP.net, where I got to Display DATE,CLASSROOM,STATUS in a Datagrid.

    The problem here is how I am going to display Date, Classroom and Status inside my datagrid. I am going to use a Stored Procedure.

    Since my First Table has the Class_ID, how am I going to reference it and show my Classroom instead of the ID.

    Is there any simple query I can use. Since there are many records in the First Table.

  • Hi Raj,

    You can get the output in the following way......

    SELECT DATE, ClassRoom, Status FROM first_table INNER JOIN class_table ON class_table.class_id=first_table.class_id Order By ClassRoom

    Phani

  • Sorry I have a WHERE Clause on my First Table, so where should I put that???

  • Add the WHERE Clause before Order By Clause. something like this....

    SELECT DATE, ClassRoom, Status FROM first_table INNER JOIN class_table ON class_table.class_id=first_table.class_id WHERE ID>1 Order By ClassRoom

Viewing 4 posts - 1 through 3 (of 3 total)

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