Click here to Skip to main content
14,329,594 members
Rate this:
Please Sign up or sign in to vote.
See more:
hi iam using the below code to get min and max values from the column name request date. but iam getting same values for both.

ALTER
PROCEDURE [dbo].[test_GetOrders]
(
@cust_id
int
)
AS
BEGIN

SELECT
o.ORD_ID ,
min(ODD_RequestDate) as min_date,

max(ODD_RequestDate) as max_date,

count(*) as no_of_items
FROM
dbo.Orders as o JOIN Orderdetails as c ON c.ODD_ORD_ID = o.ORD_ID
WHERE ORD_CUS_ID=@cust_id
GROUP By o.ORD_ID
end
Posted
Rate this:
Please Sign up or sign in to vote.

Solution 1

sridevikavalakuntla wrote:
FROM dbo.Orders as o JOIN Orderdetails as c


Try INNER JOIN...in place of just JOIN
   
Rate this:
Please Sign up or sign in to vote.

Solution 2

stil getting the same problem no change in the values
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100