using System;
namespace LastPositiveNumber
{
class Program
{
static void Main(string[] args)
{
int result = 0;
int[] array = new int[10] { 1, 2, -5, 7, 9, -3, 4, 5, -7, -5 };
foreach (var item in array)
result = item > 0 ? item : result;
if (result > 0)
Console.WriteLine(result);
else
Console.WriteLine("Положительных чисел нет");
Console.ReadLine();
}
}
}
with cat_max(cat_id, max_price) as
(
select category, MAX(price)
from Product
group by category
)
select c.name as 'Category', p.name as 'Product', cm.max_price as 'Max price'
from Product as p join cat_max as cm
on p.price = cm.max_price
and p.category = cm.cat_id
join Category as c on c.id = cm.cat_id