I have a table in sql, in the my table there are 3 columns (no of schedule, name of class, penalty cost)..
So I need to take all values in penalty cost column and compare them to know which one has the smallest cost..
and I need to write it in c#..
thx
Pankaj Kumar ChoudharyPosted May 13, 2015, 9:24 PM
select name_OF_Class,min(Penalty_Cost) as Cost from Table_Name group by name_OF_Class
if you want to take minimum value from whole column then this command can be use
select min(name_OF_Class) as name_OF_Class from Table_Name
Dipankar BiswasPosted May 13, 2015, 1:54 PM
Check this links..http://www.tutorialspoint.com/sql/sql-useful-functions.htm
Example in c#..http://www.c-sharpcorner.com/UploadFile/rohatash/countall-vs-countdistinct-in-sql-server-2012/