Quantcast
Channel: How to do this Query?
Browsing latest articles
Browse All 8 View Live

Re: How to do this Query?

DECLARE @Products TABLE (ProductID INT, ProductName VARCHAR(200), Price DECIMAL) DECLARE @ProductsUnique TABLE (Row_ID INT IDENTITY(1,1), ProductID INT, ProductName VARCHAR(200), Price DECIMAL) DECLARE...

View Article



Re: How to do this Query?

SELECT TOP(3) * FROM YOURTABLE WHERE PRICE < @X ORDER BY PRICE DESC

View Article

Re: How to do this Query?

select a.product,sum(b.price) as totprice from table a,table b where a.sno<=b.sno group by a.producthaving sum(b.price)<=x

View Article

Re: How to do this Query?

Hi,select top 5 * from tablename where x < 1000

View Article

Re: How to do this Query?

DECLARE @ConditionValue INT SET @ConditionValue = 1000 SELECT TOP 3 * FROM <<YOURTABLE>> WHERE Price < @ConditionVALUE ORDER BY PriceJust got your question :) sorry for that!!

View Article


How to do this Query?

Hi there.I want to query for top n records where sum of the price is under x.for example x = 1000Record1: Price=500Record2: Price=200Record3: Price=100Record4: Price=300in this case just top 3 records...

View Article

Re: How to do this Query?

--SQL Server 2012 SELECT ProductID, Price FROM (SELECT ProductID, Price , SUM(Price) Over(Order By ProductID) as runningTotal FROM @Products ) t WHERE runningTotal<1000 ORDER BY ProductID

View Article

Re: How to do this Query?

sairam62.cseselect a.product,sum(b.price) as totprice from table a,table b where a.sno<=b.sno group by a.producthaving sum(b.price)<=x Change to:SELECT a.ProductID, a.Price FROM @Products a,...

View Article

Browsing latest articles
Browse All 8 View Live




Latest Images