Reputation: 5455
I need to get rows where one column is a certain percentage greater than another.
So say I have 2 columns:
InventoryLevel int
InventoryAlert int
I need to get all rows where the InventoryLevel
is 25% greater than the InventoryAlert
.
Is that possible to do all in one query? Any help would be greatly appreciated!
Upvotes: 3
Views: 5843
Reputation: 453008
SELECT InventoryLevel,
InventoryAlert
FROM YourTable
WHERE InventoryLevel > 1.25 * InventoryAlert
/*Incorrect for stated question but meets clarification in comment
"InventoryLevel is any value greater than 25%, doesn't have to be exact. "*/
Upvotes: 7
Reputation: 70638
SELECT *
FROM YourTable
WHERE InventoryLevel = 1.25*InventoryAlert -- Or Maybe >= ?
Upvotes: 4