2

I'm new to SQL so this took my a long time without being able to figure it out. My table looks like this:

+------+------+------+
|ID    |2016  | 2017 |
+------+------+------+
|1     |A     |A     |
+------+------+------+
|2     |A     |B     |
+------+------+------+
|3     |B     |B     |
+------+------+------+
|4     |B     |C     |
+------+------+------+

I would like to have only the rows which have changed from 2016 to 2017:

+------+------+------+
|ID    |2016  | 2017 |
+------+------+------+
|2     |A     |B     |
+------+------+------+
|4     |B     |C     |
+------+------+------+

Could you please help ?

3
  • This question has a pretty basic SQL solution that is already posted below. However, for clarity, what database client are you using? Commented Jun 17, 2017 at 21:46
  • Oracle EssBase. Commented Jun 18, 2017 at 22:39
  • Just an FYI – I updated the question to remove the Essbase tag. You probably have Essbase in your environment somewhere, but this is actually the relational database (SQL Server, Oracle relational) side of things Commented Jun 20, 2017 at 16:45

1 Answer 1

3

select * from mytable where column_2016<>column_2017 assuming your column labels are column_2016 and column_2017

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.