I have the following code where @chemicalTypeId is a parameter in my stored procedure GetRandomChemicals:
select * from chemicals
where chemicalTypeId1 = @chemicalTypeId
or chemicalTypeId2 = @chemicalTypeId
or chemicalTypeId3 = @chemicalTypeId
or chemicalTypeId4 = @chemicalTypeId
GetRandomChemicals should return up to 6 chemicals with a chemicalTypeId (1 to 4) that is equal to @chemicalTypeId.
GetRandomChemicals can return from 0 records to hundreds of records. However I want to randomly return up to a maximum of 6 records / chemicals each time the stored procedure is called.
How can I do this?? Please help. Any suggestions or information would be appreciated. Thank you in advance.
select * from chemicals
where chemicalTypeId1 = @chemicalTypeId
or chemicalTypeId2 = @chemicalTypeId
or chemicalTypeId3 = @chemicalTypeId
or chemicalTypeId4 = @chemicalTypeId
GetRandomChemicals should return up to 6 chemicals with a chemicalTypeId (1 to 4) that is equal to @chemicalTypeId.
GetRandomChemicals can return from 0 records to hundreds of records. However I want to randomly return up to a maximum of 6 records / chemicals each time the stored procedure is called.
How can I do this?? Please help. Any suggestions or information would be appreciated. Thank you in advance.