بتاريخ: 28 سبتمبر 200916 سنة comment_170840 ممكن اشرح السؤال بالانجليزي ولكم الحريه باختيار الجواب بأي لغه I have this query select name, max(sales),max(buy) from trades group by name I want the query to display the "Type (sale or Buy)", max(buy) or max(sale) ONLY when the value is not 0 as seen below as you see above John has Max(sale) != 0 and max(buy) != 0 but in Tim's case, max(sale) is 0 so I haven't displayed it ,,, so, please how could i generate a query to solve such case !!!! تقديم بلاغ
بتاريخ: 28 سبتمبر 200916 سنة كاتب الموضوع comment_170841 طبعا الصوره في الاعلى هي ناتج الاستعلام الذي ارغب في الحصول عليهولكم جزيل الشكر تقديم بلاغ
بتاريخ: 28 سبتمبر 200916 سنة كاتب الموضوع comment_170859 وجدنا الحلالحل كالتالي select name , 'sale' , sum (sales) from trades group by name having sum (sales) > 0 union all select name , 'buy' , sum (buy) from trades group by name having sum (sales) > 0 تقديم بلاغ
انضم إلى المناقشة
يمكنك المشاركة الآن والتسجيل لاحقاً. إذا كان لديك حساب, سجل دخولك الآن لتقوم بالمشاركة من خلال حسابك.