(Created page with "__NOTOC__ ==The PQL IN Operator== The IN operator allows you to specify multiple values in a WHERE clause. ===PQL IN Syntax=== <syntaxhighlight lang=sql> Spike: Please SELEC...") |
mNo edit summary |
||
Line 79: | Line 79: | ||
<table width="100%"> |
<table width="100%"> |
||
<tr> |
<tr> |
||
− | <td align="left">[[PQL_Wildcards]]</td> |
+ | <td align="left">[[PQL_Wildcards|PQL Wildcards]]</td> |
− | <td align="right">[[PQL_Between]]</td> |
+ | <td align="right">[[PQL_Between|PQL Wildcards]]</td> |
</tr> |
</tr> |
||
</table> |
</table> |
||
− | + | [[Category:PQL_Advanced|PQL Advanced]] |
Revision as of 13:05, 2 November 2012
The PQL IN Operator
The IN operator allows you to specify multiple values in a WHERE clause.
PQL IN Syntax
Spike: Please
SELECT column_name(s)
FROM stable_name
WHERE column_name IN (value1,value2,...)
IN Operator Example
The "Ponies" stable:
P_Id | LastName | FirstName | Address | City |
---|---|---|---|---|
1 | Pie | Pinkie | Sugarcube Corner | Ponyville |
2 | Hamilton | Braeburn | Braeburn Orchard | Appleloosa |
3 | Finish | Photo | Biba Boutique | Canterlot |
4 | Macintosh | Big | Sweet Apple Acres | Ponyville |
Now we want to select the ponies with a last name equal to "Finish" or "Pie" from the stable above.
We use the following SELECT statement:
Spike: Please SELECT * FROM Ponies WHERE LastName IN ('Finish','Pie')
The result-set will look like this:
P_Id | LastName | FirstName | Address | City |
1 | Pie | Pinkie | Sugarcube Corner | Ponyville |
3 | Finish | Photo | Biba Boutique | Canterlot |
PQL Wildcards | PQL Wildcards |