2
I created the following query in my BD, I need to create a View from this query, the same should return the 3 initial columns realized, meta and accumulated, according to which the select is performing, but the moment I am performing a select in the view I must pass a Where informing the channel code, that part I am unable to create, could help me?
Can better exemplify Gabriel, what she is returning in the view and which field within the view you will filter ?
– badCode
@badCode today she’s returning the columns
A.REALIZADO, A.META e ACUMULADO
in that same View I need to pass the fieldVEN.AD_CODCANAL
as parameter, this field returns the channel in which it is being invoiced, because to insert in my application this would be the best way.– Gabriel Paixão Justino
You need to include in the view return this VEN.AD_CODCANAL to be able to filter, if you don’t have it today you will have to link by Join until you find the VEN.AD_CODCANAL and then you will filter with Where (select * from minhaview Where AD_CODCANAL = 'xxx') got it ?
– badCode
@badCode there is the problem, in my select it is already being filtered, it is repeated three times as you can see above
AND VEN1.AD_CODCANAL=1
,AND VEN1.AD_CODCANAL=1
,AND VEN1.AD_CODCANAL=1
, it brings the result of the correct channel, but I want to be able to filter outside the View, because I have more than one channel to display, and it would not be feasible to create a view per channel...– Gabriel Paixão Justino
So I think it went bad, because there is no way to pass parameter like this, the view is the place for you to save the state of what you need and apply the query on top of the data...
– badCode
You can turn the display (view) in a user function of type inline table-Valued, which is efficiently executed. See https://answall.com/questions/207629/view-com-par%C3%a2metros-sem-Where-external/
– José Diz
To understand how the expansion of an exhibition takes place (view), vide https://answall.com/questions/224619/select-em-view-gera-subquery/
– José Diz