Hi,
I have to write a stored procedure that will generate a summary result.
In this stored procedure I have a requirement that I have to group the
result based on the input field.
Here is my table structure:
Code:
USERID VARCHAR(50),
WEBSESSION_ID VARCHAR(50),
WEBHITAT_DATE DATE,
FROMHOSTIP VARCHAR(39),
FROMCOUNTRY VARCHAR(100),
FROMCITY VARCHAR(100),
START_TIME TIME,
END_TIME TIME,
DEPT_ID VARCHAR(20),
PROJECT_ID VARCHAR(20),
MODULE_ID VARCHAR(20),
APP_ID VARCHAR(30),
ISAUTHENTICATED CHARACTER(1),
FROMANONYMISER CHARACTER(1)
I have to get the rows that are having USERS that are having different FROMHOSTIP for same day. But the the FROMHOSTIP can be related to
PROJECT_ID or MODULE_ID or APP_ID or DEPT_ID depending on the
user requirement. I have to write a single stored procedure that do
the above job.
Till now I have learned that we can write a cursor that do job but group by
will only for one field at a time.
How I write a cursor that we give me result based on the user requirement.
Please suggest. Any help is highly appreciated.