الانتقال إلى المحتوى
View in the app

A better way to browse. Learn more.

مجموعة مستخدمي أوراكل العربية

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

استعلام للخبراء ....!

Featured Replies

بتاريخ:

السلام عليكم ورحمة الله وبركاته

الملف المرفق به توضيح الإستعلام المعقد المطلوب

جزاكم الله خيرا

My_query.doc

My_query.doc

My_query.doc

بتاريخ:

السلام عليكم
اذا كانت هذه النتيجة فى اخر الامر ستعرض على فورمة فيفضل استخدام PL/SQL وسيكون الحل اكثر تحكما منه عن SQL
وشكرا
ميجا

تم تعديل بواسطة khaledmega

بتاريخ:
  • كاتب الموضوع

جزاكم الله خيرا

بتاريخ:

مرحبا

انا عملت جدول في البيانات اللي انت كاتبها بالأول وبعد هيك عملت الإستعلام؛ وكانت النتيجة زي مابدك انت بالزبط:

---table
CREATE TABLE abc AS SELECT '24/5/2009'	a,'x' b,	-0.2 c FROM dual UNION
SELECT '24/5/2009'	,'y'	,0.5 FROM dual UNION
SELECT '24/5/2009'	,'z'	,0 FROM dual UNION
SELECT '24/5/2009'	,'f'	,0 FROM dual UNION
SELECT '24/5/2009'	,'g'	,-0.7 FROM dual UNION
SELECT '25/5/2009'	,'x'	,0 FROM dual UNION
SELECT '25/5/2009'	,'z'	,0.3 FROM dual UNION
SELECT '25/5/2009',	'y'	,-0.3 FROM dual UNION
SELECT '25/5/2009',	'g'	,0.5 FROM dual UNION
SELECT '25/5/2009',	'f'	,0.3 FROM dual UNION
SELECT '26/5/2009',	'y',	0.3 FROM dual UNION
SELECT '26/5/2009',	'z',	0 FROM dual UNION
SELECT '26/5/2009',	'x',	0 FROM dual


--query
SELECT a,count(n) nigative,count(z) no_change,count(p) positivenum, count(n)+count(z)+count(p) ALLn FROM (select a,b,c,
CASE  
WHEN c <0 THEN 1 END n,
CASE  
WHEN c =0 THEN 1 END z,
CASE  
WHEN c >0 THEN 1 END p
from abc) GROUP BY a


مع امكانية تغيير اسماء الحقول...
post-71508-1243939349_thumb.jpg

تم تعديل بواسطة ORA-2008

  • بعد 4 شهور...
بتاريخ:

هذا حل مباشر


select dat,
nvl((select count(*) from status where change>0 and status .dat=aa.dat group by dat),0) positive
, nvl((select count(*) from status where change<0 and status .dat=aa.dat group by dat),0) negative
,nvl((select count(*) from status where change=0 and status .dat=aa.dat group by dat),0) zero
,nvl((select count(*) from status where status .dat=aa.dat group by dat),0) tot
from status aa group by dat

بتاريخ:

هذا الحل افضل

select dat,nvl((select count(*) from status where change>0 and status .dat=aa.dat ),0) positive
         , nvl((select count(*) from status where change<0 and status .dat=aa.dat  ),0) negative
         ,nvl((select count(*) from status where change=0 and status .dat=aa.dat  ),0) zero
          ,nvl((select count(*) from status where status .dat=aa.dat  group by dat),0) tot
       from status aa group by dat
/

انضم إلى المناقشة

يمكنك المشاركة الآن والتسجيل لاحقاً. إذا كان لديك حساب, سجل دخولك الآن لتقوم بالمشاركة من خلال حسابك.

زائر
أضف رد على هذا الموضوع...

برجاء الإنتباه

بإستخدامك للموقع فأنت تتعهد بالموافقة على هذه البنود: سياسة الخصوصية

Account

Navigation

البحث

إعداد إشعارات المتصفح الفورية

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.