<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>L. MIS - MySQL select之用法</title>
    <link>https://mis.linyumo.tw/forum-15-1.html</link>
    <description>Latest 20 threads of MySQL select之用法</description>
    <copyright>Copyright(C) L. MIS</copyright>
    <generator>Discuz! Board by Comsenz Inc.</generator>
    <lastBuildDate>Thu, 04 Jun 2026 20:19:02 +0000</lastBuildDate>
    <ttl>60</ttl>
    <image>
      <url>https://mis.linyumo.tw/static/image/common/logo_88_31.gif</url>
      <title>L. MIS</title>
      <link>https://mis.linyumo.tw/</link>
    </image>
    <item>
      <title>使用 substring 查詢子字串</title>
      <link>https://mis.linyumo.tw/thread-270-1-1.html</link>
      <description><![CDATA[select substring(fields,x,y) from yourtable;
利用 substring() 函數來擷取某一欄位固定字串長度的子字串
範例如下：
一資料表，裡面包含電話號碼的欄位，但我們只是要擷取前面兩碼來便是所屬區域，則可下達如下指令
select substring(phone,1,2) from distributors;
 ...]]></description>
      <category>MySQL select之用法</category>
      <author>admin</author>
      <pubDate>Sat, 09 Sep 2023 14:32:20 +0000</pubDate>
    </item>
    <item>
      <title>按列彙集查詢函數結果的子句(group by 子句)</title>
      <link>https://mis.linyumo.tw/thread-228-1-1.html</link>
      <description><![CDATA[group by 子句
選出資料集後先將資料集進行排序、分組等動作，最後再在每個組別中抽出任一資料行做為結果
使用   GROUP BY，必須放在   WHERE 區塊之後   ORDER BY 之前
PS: GROUP BY 在對於有建立 INDEX 的 TABLE 查找的效率較佳
範例一說明:此範例只處理一集合內之資 ...]]></description>
      <category>MySQL select之用法</category>
      <author>admin</author>
      <pubDate>Sat, 02 Sep 2023 07:13:26 +0000</pubDate>
    </item>
    <item>
      <title>虛擬欄位(as 子句)</title>
      <link>https://mis.linyumo.tw/thread-227-1-1.html</link>
      <description><![CDATA[select prod_num,supp_code,description,unit_price *1.05 as new_price from products order by unit_price;
範例說明:
於其欄位之後加入as字眼,即代表以虛擬欄位名稱取代原來之名稱,但也可不使用as字眼,於欄位名稱之後,空一格填入欄位名稱也可
詳細範例說明結果如下圖 ...]]></description>
      <category>MySQL select之用法</category>
      <author>admin</author>
      <pubDate>Sat, 02 Sep 2023 07:08:02 +0000</pubDate>
    </item>
    <item>
      <title>運算式排序查詢(order by 子句)</title>
      <link>https://mis.linyumo.tw/thread-226-1-1.html</link>
      <description><![CDATA[select fields1,fields2,fields3,fields4 *1.05 from yourtable order by fields4;
範例說明:
查詢yourtable,並將fields4欄位*1.05,並以fields4*1.05之結果由小至大做排序
詳細範例說明如下圖:]]></description>
      <category>MySQL select之用法</category>
      <author>admin</author>
      <pubDate>Sat, 02 Sep 2023 07:06:01 +0000</pubDate>
    </item>
    <item>
      <title>排序查詢(order by 子句)</title>
      <link>https://mis.linyumo.tw/thread-225-1-1.html</link>
      <description><![CDATA[select * from yourtable where fields between 105 and 115 order by fields;(由小至大排序)
select * from yourtable where fields between 105 and 115 order by fields desc;(由大至小排序)
範例說明:
查詢資料表,依照fields欄位值介於105-115查詢做排序
使用order  ...]]></description>
      <category>MySQL select之用法</category>
      <author>admin</author>
      <pubDate>Sat, 02 Sep 2023 07:04:25 +0000</pubDate>
    </item>
    <item>
      <title>針對某一子集合條件式的查詢(in 子句)</title>
      <link>https://mis.linyumo.tw/thread-224-1-1.html</link>
      <description><![CDATA[select fields1,fields2,fields3 from table where fields1 in (1,2,3,4,5,6);
查詢針對資料表裡之欄位資料,給予查詢條件,當fields1之值包含1或2,3,4,5,6,則顯示出其資料
範例說明:
查詢distributors其資料表裡,包含distri_num,boss_name,company,之欄位資料,給予條件, ...]]></description>
      <category>MySQL select之用法</category>
      <author>admin</author>
      <pubDate>Sat, 02 Sep 2023 07:02:38 +0000</pubDate>
    </item>
    <item>
      <title>查詢介於某一條件或範圍的資料(between 子句)</title>
      <link>https://mis.linyumo.tw/thread-223-1-1.html</link>
      <description><![CDATA[select fields1,fields2 from yourtable from where fields2 between 400 and 600;
查詢表格內欄位1及欄位2之內容,且欄位2之值介於400-600之間
詳細範例如下圖說明:]]></description>
      <category>MySQL select之用法</category>
      <author>admin</author>
      <pubDate>Sat, 02 Sep 2023 07:00:31 +0000</pubDate>
    </item>
    <item>
      <title>結合where做條件式查詢</title>
      <link>https://mis.linyumo.tw/thread-222-1-1.html</link>
      <description><![CDATA[select * from yourtable where yourfileds=條件;
結合where做條件式查詢,如下範例:
select * from suppliers where supp_code =\&quot;HHT\&quot;;
說明:在這裡我們要查詢 suppliers 資料表裡 supp_code 欄位內容為 HHT 之所有相關資料
詳細說明如下圖:


 ...]]></description>
      <category>MySQL select之用法</category>
      <author>admin</author>
      <pubDate>Fri, 01 Sep 2023 04:00:02 +0000</pubDate>
    </item>
    <item>
      <title>去除重複資料(distinct 子句)</title>
      <link>https://mis.linyumo.tw/thread-221-1-1.html</link>
      <description><![CDATA[select distinct fields from yourtable;
說明:查詢你的表格欄位,並去除重複資料,僅顯示1個資料,也就是說只返回結果集合內唯一行的關鍵詞,使用 DISTINCT，必須放在 SELECT 區塊內第一個欄位的前方,且後面所跟的所有欄位都必須相同才能算重複的資料.使用時機:假如我們在 ...]]></description>
      <category>MySQL select之用法</category>
      <author>admin</author>
      <pubDate>Fri, 01 Sep 2023 03:57:11 +0000</pubDate>
    </item>
    <item>
      <title>查詢資料表指定之欄位</title>
      <link>https://mis.linyumo.tw/thread-220-1-1.html</link>
      <description><![CDATA[select fields1,fields2 from your DB;
當我們只是要查詢資料表之某些特定的欄位,並非全部,則可使用此指令
範例如下:
我們欲查詢資料庫TradeDB裡的distributorsy資料表中company及boss_name之欄位,則可下如下之指令
select company,boss_name from distributors;
如圖所 ...]]></description>
      <category>MySQL select之用法</category>
      <author>admin</author>
      <pubDate>Fri, 01 Sep 2023 03:53:58 +0000</pubDate>
    </item>
    <item>
      <title>展示出所選取之資料表所有內容</title>
      <link>https://mis.linyumo.tw/thread-219-1-1.html</link>
      <description><![CDATA[select * from yourtable;
查詢所欲查詢之資料表所有內容
如下範例:
欲查詢hsienshi此資料表所有內容,則可下達
select * from hsienshi;
詳細如下圖所示]]></description>
      <category>MySQL select之用法</category>
      <author>admin</author>
      <pubDate>Fri, 01 Sep 2023 03:52:31 +0000</pubDate>
    </item>
  </channel>
</rss>