Friday, 15 April 2011

oracle11g - sql inner table substitution -


Let me assume that I have a SQL query, as the following (I know that this question can be written better, just bear with me):

  SELECT aT.NAME second click AT From, (SELECT ts.slot_id, tgm.trans_id, tagm.agent_id slot ts, transaction TGM, agents tag WHERE ts.slot_id = (12345, 678 9 10) and Ts.slot_id = tagm.slot_id and ts.slot_id = tgm Slot_id) INNER where INNER.trans_id = aT.trans_id and INNER.agent_id = aT.trans_id  

Now it seems I want to break this query in two parts ... in the first place Internal quo I'll do some processing on the results RI will execute the code, and then will return to the outer part of the query to a lower setting. The question is, is there an easy way to simulate an internal table in SQL? For example, if 5 rows were returned in the results of internal query, but my program requires only two out of those lines, how can I write a SQL that I am trying to downgrade? Is there a way in SQL to declare a table in memory used in the query?

  SELECT at.Name second enabled AT, (SLOT_ID, TRANS_ID, AGENT_ID ------- ------------------ 230743, 3270893, 2307203 0784, 90, 230 9 7, 237021) Internal WHERE Internal.trange_id = ettrance_id and INNER.agent_id = aT.trans_id  

Simply use a subquery:

  SELECT at.Name. Join AT to another (as SLOIDI 230743, 3270893 trance_id In the form, double selection from AGENT_ID to 2307203 as double from 0784 9, 230 9 7, 237021) ii. Trans_id = at trance_id and i.agent_id = aT.trans_id;  

No comments:

Post a Comment