June 18th, 2012, 02:29 PM
Select statement help
I will try to explain my problem as simple as possible...I will try...
I have a simple select statement:
Select column1,column2 FROM Table
I am executing succcessfully the select statement which fetch some records, different every time. Now based on an int value Y (different every time the select is execute) I want to add an extra column(Column3) on my select statement in which starting from the first row until the Y rows to assign a value and after the Y number rows exceeded to assign some other value to column3. For example, If Y is equal to 3, I want the first 3 rows on my select statement to have a column3 = somevalue and the rest of the rows to have column3 = someOthervalue
How can I modify my Select statement in order to accomplish my scenario. Maybe using a loop I can do this...Are their any other ways. I want to know if any, to choose the appropriate one.
June 18th, 2012, 03:34 PM
it would be ~so~ much better to do this type of processing in the application layer using a programming language like vb or whatever
June 18th, 2012, 03:40 PM
I wish I had that option....Is an SQL Function
June 18th, 2012, 05:50 PM
Originally Posted by b1naryMan