Jump to content
powie.de Tech Forum
Sign in to follow this  
roli

Frage zu left join

Recommended Posts

Hallo

Ich habe eine Frage zu ORACLE SQL.

Aus der table CP_OBJECT_PERMISSIONS möchte ich nur Daten laden, die dem OBJECT_TYPE 'reports' entsprechen.

Doch wo setze ich nun das where statement?


Danke und gruss

select R.Name as ^Report;sortable^, OP.GROUPCODE as ^Group;sortable^ from cp_reports R 
LEFT JOIN CP_OBJECT_PERMISSIONS OP
ON R.REPORT_ID = OP.OBJECT_ID ORDER BY OP.GROUPCODE 

Share this post


Link to post
Share on other sites

es gibt 2 Möglichkeiten:

 

select R.Name as ^Report;sortable^, OP.GROUPCODE as ^Group;sortable^ 
from cp_reports R 
LEFT JOIN CP_OBJECT_PERMISSIONS OP ON R.REPORT_ID = OP.OBJECT_ID 
Where op.OBJECT_TYPE = 'reports'
ORDER BY OP.GROUPCODE

 

oder auch:

select R.Name as ^Report;sortable^, OP.GROUPCODE as ^Group;sortable^ 
from cp_reports R 
LEFT JOIN CP_OBJECT_PERMISSIONS OP ON R.REPORT_ID = OP.OBJECT_ID and op.OBJECT_TYPE = 'reports'
ORDER BY OP.GROUPCODE

 

bei nur einer where bedingung ist die erste sicher die schnellere, kommen aber mehrere joins und where Bedingungen hinzu kann auch teilweise die 2. Variante schneller in der Ausführung werden.

Share this post


Link to post
Share on other sites
Guest
You are commenting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×