|
Publicité ' | |||||||||||||||||||||||
|
|
#1 |
|
Invité de passage
![]() Inscription : juillet 2002 Messages : 7 ![]() |
Bonjour à tous,
j'ai un problème au niveau de SQL, je veux regrouper qlq requetes entre eux pour avoir une seule requete (je fais Union) mais le résultat que je trouve n'est pas juste... 1 ere requete: select f1.id, f1.longname,( select s1.value from code s1 join codeinternal s2 on s1.codeinternal_id = s2.id where s2.refobjectid = f1.id and s1.system_id = 1 and s2.refobjecttype = 'Instrument' ) ISIN,( select longname from cst_instrument_type where id = f1.type ) Type,( select subtype_longname from instrument_type where subtype_id = f1.subtype and rownum = 1 ) SubType from instrument f1 where not exists( select 1 from price w1 where w1.instrument_id = f1.id ) and f1.type in (2, 3, 4, 6, 8, 9) and f1.enabled = '1' order by Type, Subtype, f1.longname ******************************************** 2 eme requete: select f1.id, f1.longname, ( select s1.value from code s1 join codeinternal s2 on s1.codeinternal_id = s2.id where s2.refobjectid = f1.id and s1.system_id = 1 and s2.refobjecttype = 'Instrument' ) ISIN, (select longname from cst_instrument_type where id = f1.type) Type, (select subtype_longname from instrument_type where subtype_id = f1.subtype and rownum = 1) SubType from instrument f1 where exists ( select 1 from price w1 where w1.instrument_id = f1.id and w1.objecttype_id = 'RT' ) and not exists ( select 1 from price w1 where w1.instrument_id = f1.id and w1.objecttype_id = 'HS' ) and f1.type in (2, 3, 4, 6, 8, 9) and f1.enabled = '1' order by Type, Subtype, f1.longname |
|
|
00
|
|
|
#2 |
![]() ![]() ![]() Frédéric BROUARDExpert SGBDR & SQL Inscription : mai 2002 Messages : 10 959 ![]() |
Quel est le problème ? message d'erreur ???
Soit plus explicite ! Respecte ceci : http://www.developpez.net/forums/viewtopic.php?t=32668 Poste tes requête en code en utilisant les balises. A +
__________________
Frédéric Brouard - SQLpro - ARCHITECTE DE DONNÉES - expert SGBDR et langage SQL Site sur les SGBD relationnels et le langage SQL: http://sqlpro.developpez.com/ Expert Microsoft SQL Server - M.V.P. (Most valuable Professional) MS Corp. Blog SQL, SQL Server, modélisation données : http://blog.developpez.com/sqlpro http://www.sqlspot.com : modélisation, conseils, audit, optimisation, formation * * * * * Enseignant CNAM PACA - ISEN Toulon - CESI Aix en Provence * * * * * |
|
00
|
Copyright © 2000-2012 - www.developpez.com