Click here to Skip to main content
15,891,951 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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.

SQL
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

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


Try INNER JOIN...in place of just JOIN
 
Share this answer
 
stil getting the same problem no change in the values
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900