Does anyone out there know how to create a stored procedure that will return results based on the information queried?
For example:
I have a table myTable With the following fields:
anIdentifier, anAction, data1, data2, data3, data4
I want to be able to do something like:
select * from myTable where anIdentifier = 123
if anAction = 1 return anIdentifier, anAction, data1, data3
if anAction = 2 return anIdentifier, anAction, data2, data3
if anAction = 3 return anIdentifier, anAction, data1, data2, data3
Can a stored procedure be created that can do this or am I just dreaming?Originally posted by rwaver
Does anyone out there know how to create a stored procedure that will return results based on the information queried?
For example:
I have a table myTable With the following fields:
anIdentifier, anAction, data1, data2, data3, data4
I want to be able to do something like:
select * from myTable where anIdentifier = 123
if anAction = 1 return anIdentifier, anAction, data1, data3
if anAction = 2 return anIdentifier, anAction, data2, data3
if anAction = 3 return anIdentifier, anAction, data1, data2, data3
Can a stored procedure be created that can do this or am I just dreaming?
you can try to use case ... when ... then ...
Showing posts with label examplei. Show all posts
Showing posts with label examplei. Show all posts
Subscribe to:
Posts (Atom)