Friday, 6 September 2013

Filteration of Rows based on a column value

Filteration of Rows based on a column value

I have a table called AssetTable which stores AssetId
I have another table called AssetBookTable which stores two fields BookId
and CurrentOperationsTax
Another table AssetBook that stores AssetId and BookId as foriegn keys.
Now, I have a situation in which I have to filter records based on
AssetBookTable.CurrentOperationsTax
This, is what I am getting now,
And this, is what I want:
**
The logic is that I want only one BookId per AssetId that has either
Current/Operation/Tax for CurrentOperationsTax field.
**
Here's the SQL fiddle written so far:
SQLFiddle
Any help is greatly appreciated.

No comments:

Post a Comment