بتاريخ: 17 سبتمبر 200817 سنة comment_139031 ياجماعة بدي مساعة في جملة sqlTitles.titleno title20 mathmatic titleauthstitleno authno20 120 220 3authorsauthno name1 Khaled2 Amer3 tariq Select title,name from titles,titleauths,authorsWhere titles.titleno=titleauths.titleno andTitleauths.authno=authors.authno;النتيجةMathmatic khaledMathmatic amerMathmatic tariqولكني بدي جملة النتيجة كالاتي Mathmatic \ khaled ; amer; tariq وليس كل حقل في سطر تقديم بلاغ
بتاريخ: 17 سبتمبر 200817 سنة comment_139040 السلام عليكم ورحمة الله وبركاتهاخي فاللهبعد التحيةاتمني ان تجد ضالتك فهذه السطور المتواضعه CREATE OR REPLACE FUNCTION get_name_auth RETURN CHAR IS x VARCHAR2 (1000); BEGIN FOR i IN (SELECT title, NAME FROM titles, titleauths, authors WHERE titles.titleno = titleauths.titleno AND titleauths.authno = authors.authno) LOOP IF x IS NULL THEN x := i.title || ' \ ' || i.NAME; ELSE x := x || ' ; ' || i.NAME; END IF; END LOOP; RETURN x; END; SELECT get_name_auth FROM DUAL وفقك الله الى ماتحب ويرضي تقديم بلاغ
بتاريخ: 21 سبتمبر 200817 سنة comment_139403 بامكانك ايضا ان تقوم بعملها باستخدام SQL select p.title, substr(max(substr(sys_connect_by_path (p.name,'; '),2)),1,60) from (select title, name, row_number() over (partition by title order by title, name) rn from (Select title,name from titles,titleauths,authors Where titles.titleno=titleauths.titleno and Titleauths.authno=authors.authno) x ) p start with p.rn = 1 connect by p.rn = prior p.rn + 1 and prior p.title = p.title group by title; أول لتخفيف الكود بامكانك عمل view من الاستعلام المستخدم من قبلككالتالي create view title1 as Select title,name from titles,titleauths,authors Where titles.titleno=titleauths.titleno and Titleauths.authno=authors.authno; لتصبح جملة الاستعلام كالتالي select p.title, substr(max(substr(sys_connect_by_path (p.name,'; '),2)),1,60) from (select title, name, row_number() over (partition by title order by title, name) rn from title1) p start with p.rn = 1 connect by p.rn = prior p.rn + 1 and prior p.title = p.title group by title; تقديم بلاغ
انضم إلى المناقشة
يمكنك المشاركة الآن والتسجيل لاحقاً. إذا كان لديك حساب, سجل دخولك الآن لتقوم بالمشاركة من خلال حسابك.