SQL Join / Union -


I have two statements that I want to merge into an output.

Statement One:

  Select the name from the Oxylliri_Variable_Inquire where the check_IDbcd = '063'  

gives the following list of names:

  name ---- -------- affiliate netbook value guardian worldbase  

statement two:

 < Select the code> name, the value from the Assistant_value_value where the inquir_idbr_code = '063' and ru_ref = 20120000008 and duration = 20012  

gives the following:

  The value of ----------------- - 112 NetbookEvolution 225.700 affiliate -   

I have to be an output like this:

Value of name ----------- -------- Partner 112 Netbook value 225.700 Parents 0 WorldBus 0

So basically, if only 2 names and values ​​come in the second query, then I still would like to display fully the set of name es from the first query, If all the four values ​​come back with all the questions, then all four will be displayed.

Sorry, I have to add IM using Ingres SQL so that I can not use the ISNL function.

I recommend to include myself, which uses the left OUTER JOIN syntax In the case of the second query, include your 'Additional' conditions, while in the first situations, stay in WHERE:

  one. Select the name, the case when b.Value is nulled 0 Add a helper at a.name = b.name from Auxiliary_variable_inquiry as ELSE b.Value END auxiliary_variable_inquiry b - and replace it with your real ID-based join a. Inquiry_idbr_code = b.inquiry_idbr_code and b.ru_ref = 20120000008 and b. Period = 200912 where an.inquiry_idbr_code = '063'  

Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -