Sql Student-446896 (8/22/2013)
I want to get the 10.1 and 10.2 in my output. How do i get that?
Table A has the columns change_id
There's about a thousand ways in SQL to get those 2 rows out of the sample data. But you haven't given enough information about the business rule to help us help you:
1. I want all the values in the result set whose change_id is > 10.
2. I want the 2 largest change_id values.
3. I want only change_id values where the number of digits to the left of the decimal point are 2.
4. I want the 2 highest ranked changes, which may contain more than 2 rows in the case of a tie.
5. I want the rows where the change_id sums to 20.3.
These are just a few examples of how the clarity of the business rule could affect the final query you're going to deliver.
BWAAA-HAAAA!!! Good guesses, Dwain, but it's painfully obvious that the OP wanted the two numbers whose sum is the cube root of 8365.427 which has only decending number pairs from left to right with the last digit forming a single-digit "pair", has no duplicate digits, and has all possible digits greater than 0 except for 1 and 9. :-P
is pronounced ree-bar and is a Modenism for R
First step towards the paradigm shift of writing Set Based code: Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
Although they tell us that they want it real bad, our primary goal is to ensure that we dont actually give it to them that way.
Although change is inevitable, change for the better is not.
Just because you can do something in PowerShell, doesnt mean you should. Helpful Links:
How to post code problemsHow to post performance problemsForum FAQs