| 1 |
<!DOCTYPE html> |
| 2 |
<html><head> |
| 3 |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 4 |
<meta http-equiv="content-type" content="text/html; charset=UTF-8"> |
| 5 |
<link href="../sqlite.css" rel="stylesheet"> |
| 6 |
<title>SQLite Syntax: with-clause</title> |
| 7 |
<!-- path=../ --> |
| 8 |
</head> |
| 9 |
<body> |
| 10 |
<div class=nosearch> |
| 11 |
<a href="../index.html"> |
| 12 |
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> |
| 13 |
</a> |
| 14 |
<div><!-- IE hack to prevent disappearing logo --></div> |
| 15 |
<div class="tagline desktoponly"> |
| 16 |
Small. Fast. Reliable.<br>Choose any three. |
| 17 |
</div> |
| 18 |
<div class="menu mainmenu"> |
| 19 |
<ul> |
| 20 |
<li><a href="../index.html">Home</a> |
| 21 |
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> |
| 22 |
<li class='wideonly'><a href='../about.html'>About</a> |
| 23 |
<li class='desktoponly'><a href="../docs.html">Documentation</a> |
| 24 |
<li class='desktoponly'><a href="../download.html">Download</a> |
| 25 |
<li class='wideonly'><a href='../copyright.html'>License</a> |
| 26 |
<li class='desktoponly'><a href="../support.html">Support</a> |
| 27 |
<li class='desktoponly'><a href="../prosupport.html">Purchase</a> |
| 28 |
<li class='search' id='search_menubutton'> |
| 29 |
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> |
| 30 |
</ul> |
| 31 |
</div> |
| 32 |
<div class="menu submenu" id="submenu"> |
| 33 |
<ul> |
| 34 |
<li><a href='../about.html'>About</a> |
| 35 |
<li><a href='../docs.html'>Documentation</a> |
| 36 |
<li><a href='../download.html'>Download</a> |
| 37 |
<li><a href='../support.html'>Support</a> |
| 38 |
<li><a href='../prosupport.html'>Purchase</a> |
| 39 |
</ul> |
| 40 |
</div> |
| 41 |
<div class="searchmenu" id="searchmenu"> |
| 42 |
<form method="GET" action="../search"> |
| 43 |
<select name="s" id="searchtype"> |
| 44 |
<option value="d">Search Documentation</option> |
| 45 |
<option value="c">Search Changelog</option> |
| 46 |
</select> |
| 47 |
<input type="text" name="q" id="searchbox" value=""> |
| 48 |
<input type="submit" value="Go"> |
| 49 |
</form> |
| 50 |
</div> |
| 51 |
</div> |
| 52 |
<script> |
| 53 |
function toggle_div(nm) { |
| 54 |
var w = document.getElementById(nm); |
| 55 |
if( w.style.display=="block" ){ |
| 56 |
w.style.display = "none"; |
| 57 |
}else{ |
| 58 |
w.style.display = "block"; |
| 59 |
} |
| 60 |
} |
| 61 |
function toggle_search() { |
| 62 |
var w = document.getElementById("searchmenu"); |
| 63 |
if( w.style.display=="block" ){ |
| 64 |
w.style.display = "none"; |
| 65 |
} else { |
| 66 |
w.style.display = "block"; |
| 67 |
setTimeout(function(){ |
| 68 |
document.getElementById("searchbox").focus() |
| 69 |
}, 30); |
| 70 |
} |
| 71 |
} |
| 72 |
function div_off(nm){document.getElementById(nm).style.display="none";} |
| 73 |
window.onbeforeunload = function(e){div_off("submenu");} |
| 74 |
/* Disable the Search feature if we are not operating from CGI, since */ |
| 75 |
/* Search is accomplished using CGI and will not work without it. */ |
| 76 |
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ |
| 77 |
document.getElementById("search_menubutton").style.display = "none"; |
| 78 |
} |
| 79 |
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ |
| 80 |
function hideorshow(btn,obj){ |
| 81 |
var x = document.getElementById(obj); |
| 82 |
var b = document.getElementById(btn); |
| 83 |
if( x.style.display!='none' ){ |
| 84 |
x.style.display = 'none'; |
| 85 |
b.innerHTML='show'; |
| 86 |
}else{ |
| 87 |
x.style.display = ''; |
| 88 |
b.innerHTML='hide'; |
| 89 |
} |
| 90 |
return false; |
| 91 |
} |
| 92 |
var antiRobot = 0; |
| 93 |
function antiRobotGo(){ |
| 94 |
if( antiRobot!=3 ) return; |
| 95 |
antiRobot = 7; |
| 96 |
var j = document.getElementById("mtimelink"); |
| 97 |
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); |
| 98 |
} |
| 99 |
function antiRobotDefense(){ |
| 100 |
document.body.onmousedown=function(){ |
| 101 |
antiRobot |= 2; |
| 102 |
antiRobotGo(); |
| 103 |
document.body.onmousedown=null; |
| 104 |
} |
| 105 |
document.body.onmousemove=function(){ |
| 106 |
antiRobot |= 2; |
| 107 |
antiRobotGo(); |
| 108 |
document.body.onmousemove=null; |
| 109 |
} |
| 110 |
setTimeout(function(){ |
| 111 |
antiRobot |= 1; |
| 112 |
antiRobotGo(); |
| 113 |
}, 100) |
| 114 |
antiRobotGo(); |
| 115 |
} |
| 116 |
antiRobotDefense(); |
| 117 |
</script> |
| 118 |
<h1 align='center'>with-clause</h1> |
| 119 |
<div class='imgcontainer'> |
| 120 |
<div style="max-width:1056px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 1056.72 140.4"> |
| 121 |
<circle cx="5" cy="85" r="3.6" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 122 |
<polygon points="32,85 20,89 20,81" style="fill:rgb(0,0,0)"/> |
| 123 |
<path d="M9,85L26,85" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 124 |
<path d="M47,100L78,100A15 15 0 0 0 93 85A15 15 0 0 0 78 70L47,70A15 15 0 0 0 32 85A15 15 0 0 0 47 100Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 125 |
<text x="62" y="85" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text> |
| 126 |
<polygon points="134,55 123,59 123,50" style="fill:rgb(0,0,0)"/> |
| 127 |
<path d="M93,85 L 100,85 Q 108,85 108,70 L 108,70 Q 108,55 118,55 L 129,55" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 128 |
<path d="M150,70L235,70A15 15 0 0 0 250 55L250,55A15 15 0 0 0 235 39L150,39A15 15 0 0 0 134 55L134,55A15 15 0 0 0 150 70Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 129 |
<text x="192" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text> |
| 130 |
<path d="M250,55 L 258,55 Q 265,55 265,70 L 265,70 Q 265,85 273,85 L 280,85" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 131 |
<polygon points="307,85 295,89 295,81" style="fill:rgb(0,0,0)"/> |
| 132 |
<path d="M280,85L301,85" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 133 |
<path d="M307,100L444,100L444,70L307,70Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 134 |
<text x="375" y="85" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">cte-table-name</text> |
| 135 |
<polygon points="467,85 455,89 455,81" style="fill:rgb(0,0,0)"/> |
| 136 |
<path d="M444,85L461,85" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 137 |
<path d="M482,100L486,100A15 15 0 0 0 501 85A15 15 0 0 0 486 70L482,70A15 15 0 0 0 467 85A15 15 0 0 0 482 100Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 138 |
<text x="484" y="85" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text> |
| 139 |
<polygon points="542,17 531,21 531,12" style="fill:rgb(0,0,0)"/> |
| 140 |
<path d="M501,85 L 508,85 Q 516,85 516,70 L 516,32 Q 516,17 526,17 L 537,17" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 141 |
<path d="M558,32L578,32A15 15 0 0 0 593 17L593,17A15 15 0 0 0 578 2L558,2A15 15 0 0 0 542 17L542,17A15 15 0 0 0 558 32Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 142 |
<text x="568" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text> |
| 143 |
<polygon points="610,17 599,21 599,12" style="fill:rgb(0,0,0)"/> |
| 144 |
<path d="M593,17L604,17" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 145 |
<path d="M625,32L743,32A15 15 0 0 0 759 17L759,17A15 15 0 0 0 743 2L625,2A15 15 0 0 0 610 17L610,17A15 15 0 0 0 625 32Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 146 |
<text x="684" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATERIALIZED</text> |
| 147 |
<polygon points="800,85 789,89 789,81" style="fill:rgb(0,0,0)"/> |
| 148 |
<path d="M759,17 L 766,17 Q 774,17 774,32 L 774,70 Q 774,85 784,85 L 794,85" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 149 |
<path d="M815,100A15 15 0 0 0 830 85A15 15 0 0 0 815 70A15 15 0 0 0 800 85A15 15 0 0 0 815 100Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 150 |
<text x="815" y="85" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text> |
| 151 |
<polygon points="853,85 842,89 842,81" style="fill:rgb(0,0,0)"/> |
| 152 |
<path d="M830,85L848,85" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 153 |
<path d="M853,100L958,100L958,70L853,70Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 154 |
<text x="905" y="85" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text> |
| 155 |
<polygon points="981,85 969,89 969,81" style="fill:rgb(0,0,0)"/> |
| 156 |
<path d="M958,85L975,85" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 157 |
<path d="M996,100A15 15 0 0 0 1011 85A15 15 0 0 0 996 70A15 15 0 0 0 981 85A15 15 0 0 0 996 100Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 158 |
<text x="996" y="85" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text> |
| 159 |
<polygon points="1047,85 1035,89 1035,81" style="fill:rgb(0,0,0)"/> |
| 160 |
<path d="M1011,85L1041,85" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 161 |
<circle cx="1050" cy="85" r="3.6" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 162 |
<polygon points="542,56 531,60 531,52" style="fill:rgb(0,0,0)"/> |
| 163 |
<path d="M501,85 L 508,85 Q 516,85 516,70 Q 516,56 526,56 L 537,56" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 164 |
<path d="M558,71L676,71A15 15 0 0 0 691 56A15 15 0 0 0 676 41L558,41A15 15 0 0 0 542 56A15 15 0 0 0 558 71Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 165 |
<text x="617" y="56" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATERIALIZED</text> |
| 166 |
<polygon points="759,56 747,60 747,52" style="fill:rgb(0,0,0)"/> |
| 167 |
<path d="M691,56L753,56" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 168 |
<path d="M759,56 L 766,56 Q 774,56 774,64 L 774,71" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 169 |
<polygon points="617,85 605,89 605,81" style="fill:rgb(0,0,0)"/> |
| 170 |
<path d="M501,85L611,85" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 171 |
<path d="M617,85L800,85" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 172 |
<path d="M659,138A15 15 0 0 0 674 123L674,123A15 15 0 0 0 659 108A15 15 0 0 0 644 123L644,123A15 15 0 0 0 659 138Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 173 |
<text x="659" y="123" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text> |
| 174 |
<polygon points="674,123 686,118 686,127" style="fill:rgb(0,0,0)"/> |
| 175 |
<path d="M1011,85 L 1018,85 Q 1026,85 1026,100 L 1026,108 Q 1026,123 1011,123 L 695,123 L 680,123" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 176 |
<path d="M644,123 L 295,123 Q 280,123 280,108 L 280,100 Q 280,85 288,85 L 295,85" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 177 |
<path d="M93,85L295,85" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 178 |
</svg> |
| 179 |
</div><br> |
| 180 |
<br></br> |
| 181 |
References: <a href='./cte-table-name.html'>cte-table-name</a> <a href='./select-stmt.html'>select-stmt</a><br></br> |
| 182 |
See also: <a href='../lang_with.html'>lang_with.html</a> |
| 183 |
</div> |
| 184 |
|
| 185 |
|
| 186 |
|