Skip to Content
0
Former Member
Oct 19, 2015 at 09:39 AM

Edit to exisiting number query

43 Views

Hello All,


I need some help on the below query, right now it's showing everything within a fixed 10% of the Variable data that the user enters.


I need the fixed 10% to become a variable also, so i can say i want to see within 50% or 47% or any random %


/* SELECT FROM OITM P1 */

DECLARE @RANGE1 AS DECIMAL(10 ,3)

/* WHERE */

SET @RANGE1 = /* P1.U_Attribute1 */ [%1]

/* SELECT FROM OITM P2 */

DECLARE @RANGE2 AS DECIMAL(10 ,3)

/* WHERE */

SET @RANGE2 = /* P2.U_Attribute2 */ [%2]

/* SELECT FROM OITM P3 */

DECLARE @RANGE3 AS DECIMAL(10 ,3)

/* WHERE */

SET @RANGE3 = /* P3.U_Attribute3 */ [%3]

SELECT T0.[ItemCode], T0.frgnname, T0.[U_Attribute1], T0.[U_Attribute2], T0.[U_Attribute3], T0.[U_Attribute4] FROM OITM T0

WHERE U_Attribute1 BETWEEN @RANGE1*0.9 AND @RANGE1*1.1

AND U_Attribute2 BETWEEN @RANGE2*0.9 AND @RANGE2*1.1

AND U_Attribute3 BETWEEN @RANGE3*0.9 AND @RANGE3*1.1

Is this something somebody can help me out with?

cheers

Jamie