oracle - Dynamic query to dynamic data -


i new oracle database, trying execute following query

select o.id ovaid , (case when(select count(m.cid) ovamapper m m.id = o.id , m.solutionid = 1)>0 1 else 0 end) sol1, (case when(select count(m.cid) ovamapper m m.id = o.id , m.solutionid = 2)>0 1 else 0 end) sol1, (case when(select count(m.cid) ovamapper m m.id = o.id , m.solutionid = 3)>0 1 else 0 end) sol1 ovatemplate o order o.id 

instead of static values solutionid , select other table.

any on appreciated

you use

join

to table contain solutionid. ex

select * ovatemplate join solutiontable on (solutiontable.ovaid=ovatempate.ovaid)  

after that, change static values solutionid


Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -