Edit C:\Program Files (x86)\SAP BusinessObjects\SAP BusinessObjects Enterprise XI 4.0\win32_x86\odbc\7.0.1\help\reference\sqlsupport.12.12.html
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <!-- MOTW-DISABLED saved from url=(0014)about:internet --> <title>Create View</title> <link rel="StyleSheet" href="css/sqlsupport.css" type="text/css" media="all" /> <link rel="StyleSheet" href="css/webworks.css" type="text/css" media="all" /> <script type="text/javascript" language="JavaScript1.2" src="wwhdata/common/context.js"></script> <script type="text/javascript" language="JavaScript1.2" src="wwhdata/common/towwhdir.js"></script> <script type="text/javascript" language="JavaScript1.2" src="wwhdata/common/wwhpagef.js"></script> <script type="text/javascript" language="JavaScript1.2"> <!-- var WebWorksRootPath = ""; // --> </script> <script type="text/javascript" language="JavaScript1.2"> <!-- // Set reference to top level help frame // var WWHFrame = WWHGetWWHFrame("", true); // --> </script> <script type="text/javascript" language="JavaScript1.2" src="scripts/expand.js"></script> </head> <body class="" style="background-color: #FFFFEE;" onload="WWHUpdate();" onunload="WWHUnload();" onkeydown="WWHHandleKeyDown((document.all||document.getElementById||document.layers)?event:null);" onkeypress="WWHHandleKeyPress((document.all||document.getElementById||document.layers)?event:null);" onkeyup="WWHHandleKeyUp((document.all||document.getElementById||document.layers)?event:null);"> <br /> <div class="WebWorks_Breadcrumbs" style="text-align: left;"> <a class="WebWorks_Breadcrumb_Link" href="sqlsupport.12.01.html#109117">10 SQL Statements and Extensions for the Salesforce Driver</a> : Create View</div> <hr align="left" /> <blockquote> <div class="head_1"><a name="109117">Create View</a></div> <div class="Body"><a name="149031">The Create View statement creates a new view. A view is analogous to a named query. The </a>view's query can refer to any combination of remote and local tables as well as other views. Views are read-only; they cannot be updated.</div> <div class="gutter_text_right"><a name="149032">Grammar</a></div> <div class="syntax_first"><a name="149033">CREATE VIEW </a><span class="EquationVariables">view_name</span>[(<span class="EquationVariables">view_column</span>,...)] AS </div> <div class="syntax"><a name="149034">SELECT ... FROM ... [WHERE Expression]</a></div> <div class="syntax"><a name="149035"> [ORDER BY </a><span class="EquationVariables">order_expression</span> [, ...]]</div> <div class="syntax"><a name="149036"> [LIMIT </a><span class="EquationVariables">limit</span> [OFFSET <span class="EquationVariables">offset</span>]];</div> <div class="Body"><a name="149037">where:</a></div> <div class="Body"><span class="EquationVariables"><a name="149038">view_name</a></span> specifies the name of the view.</div> <div class="Body"><span class="EquationVariables"><a name="149039">view_column</a></span> specifies the column associated with the view. Multiple column names must be separated by commas.</div> <div class="Body"><a name="149040">The other commands used for Create View are the same as those used for Select (see </a><span class="Cross_ref_"><a href="javascript:WWHClickedPopup('reference', 'sqlsupport.12.23.html#107999', '');">â??Selectâ??</a></span>).</div> <div class="Body"><a name="149044">A view can be thought of as a virtual table. A Select statement is stored in the database; </a>however, the data accessible through a view is not stored in the database. The result set of the Select statement forms the virtual table returned by the view. You can use this virtual table by referring to the view name in SQL statements the same way you refer to a table. A view is used to perform any or all of these functions:</div> <div class="list_bulleted_outer" style="margin-left: 0pt;"> <table border="0" cellspacing="0" cellpadding="0" summary=""> <tr style="vertical-align: baseline;"> <td> <div class="list_bulleted_inner" style="width: 18pt; white-space: nowrap;">â? </div> </td> <td width="100%"> <div class="list_bulleted_inner"><a name="149045">Restrict a user to specific rows in a table.</a></div> </td> </tr> </table> </div> <div class="list_bulleted_outer" style="margin-left: 0pt;"> <table border="0" cellspacing="0" cellpadding="0" summary=""> <tr style="vertical-align: baseline;"> <td> <div class="list_bulleted_inner" style="width: 18pt; white-space: nowrap;">â? </div> </td> <td width="100%"> <div class="list_bulleted_inner"><a name="149046">Restrict a user to specific columns.</a></div> </td> </tr> </table> </div> <div class="list_bulleted_outer" style="margin-left: 0pt;"> <table border="0" cellspacing="0" cellpadding="0" summary=""> <tr style="vertical-align: baseline;"> <td> <div class="list_bulleted_inner" style="width: 18pt; white-space: nowrap;">â? </div> </td> <td width="100%"> <div class="list_bulleted_inner"><a name="149047">Join columns from multiple tables so that they function like a single table.</a></div> </td> </tr> </table> </div> <div class="list_bulleted_outer" style="margin-left: 0pt;"> <table border="0" cellspacing="0" cellpadding="0" summary=""> <tr style="vertical-align: baseline;"> <td> <div class="list_bulleted_inner" style="width: 18pt; white-space: nowrap;">â? </div> </td> <td width="100%"> <div class="list_bulleted_inner"><a name="149048">Aggregate information instead of supplying details. For example, the sum of a column, </a>or the maximum or minimum value from a column can be presented.</div> </td> </tr> </table> </div> <div class="Body"><a name="149049">Views are created by defining the Select statement that retrieves the data to be presented </a>by the view. </div> <div class="Body"><a name="203742">The Select statement in a View definition must return columns with distinct names. If the </a>names of two columns in the Select statement are the same, use a column alias to distinguish between them. Alternatively, you can define a list of new columns for a view. </div> <div class="gutter_text_right"><a name="203743">Examples</a></div> <div class="hanging_label_head"><a name="203744">Example A</a></div> <div class="Body"><a name="203818">This example creates a view named myOpportunities that selects data from three database </a>tables to present a virtual table of data.</div> <div class="syntax_first"><a name="149050">CREATE VIEW myOpportunities AS </a></div> <div class="syntax"><a name="149051">SELECT a.name AS AccountName, </a></div> <div class="syntax"><a name="149052"> o.name AS OpportunityName, </a></div> <div class="syntax"><a name="149053"> o.amount AS Amount, </a></div> <div class="syntax"><a name="149054"> o.description AS Description</a></div> <div class="syntax"><a name="149055">FROM Opportunity o INNER JOIN Account a </a></div> <div class="syntax"><a name="149056"> ON o.AccountId = a.id</a></div> <div class="syntax"><a name="149057"> INNER JOIN User u </a></div> <div class="syntax"><a name="149058"> ON o.OwnerId = u.id </a></div> <div class="syntax"><a name="149059">WHERE u.name = 'MyName' </a></div> <div class="syntax"><a name="149060"> AND o.isClosed = 'false' </a></div> <div class="syntax"><a name="149061">ORDER BY Amount desc</a></div> <div class="Body"><a name="149069">You can then refer to the myOpportunities view in statements just as you would refer to a </a>table. For example:</div> <div class="syntax_first"><a name="149070">SELECT * FROM myOpportunities;</a></div> <div class="gutter_text_right"><a name="149071"> </a></div> <div class="hanging_label_head"><a name="154820">Example B</a></div> <div class="Body"><a name="203835">The myOpportunities view contains a detailed description for each opportunity, which may </a>not be needed when only a summary is required. A view can be built that selects only specific myOpportunities columns as shown in the following example:</div> <div class="syntax_first"><a name="149072">CREATE VIEW myOpps_NoDesc as </a></div> <div class="syntax"><a name="149073">SELECT AccountName, </a></div> <div class="syntax"><a name="149074"> OpportunityName, </a></div> <div class="syntax"><a name="149075"> Amount </a></div> <div class="syntax"><a name="149076">FROM myOpportunities</a></div> <div class="Body"><a name="71180">The view selects the name column from both the opportunity and account tables. These </a>columns are assigned the alias OpportunityName and AccountName, respectively.</div> <script type="text/javascript" language="JavaScript1.2"> <!-- // Clear related topics // WWHClearRelatedTopics(); document.writeln(WWHRelatedTopicsInlineHTML()); // --> </script> </blockquote> <script type="text/javascript" language="JavaScript1.2"> <!-- document.write(WWHRelatedTopicsDivTag() + WWHPopupDivTag() + WWHALinksDivTag()); // --> </script> </body> </html>
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de