当前位置: 代码迷 >> SQL >> SQL里desc跟asc意思
  详细解决方案

SQL里desc跟asc意思

热度:108   发布时间:2016-05-05 13:51:05.0
SQL里desc和asc意思
SQL里desc和asc的意思
    desc是descend 降序意思
    asc 是ascend 升序意思
sql = "select 表内容名逗号分割 from 数据库表名 Putout=true order by 读取的排序表名 asc"
例如
sql = "select ,ID,name,time from user Putout=true order by time desc" '按最新时间来排序
sql = "select ,ID,name,time from user Putout=true order by time asc" '按早时间来排序
'这里by time desc是排序或者用ID来判断,desc为倒序 asc为正序

例子:
<?php
       $qydt_list = array();
      $query = $db->query(sprintf("SELECT title FROM %s ORDER BY id asc LIMIT 0,5 ", $TABLE_HOME));
      if ($query)
      {
       while ($zjfy = $db->fetch_array($query))
       {
        $qydt_list[] = $zjfy;
       }
      }

        foreach ($qydt_list as $zjfy_item)
        {  
       ?>
       <tr>
                        <td height="23">&nbsp;<span class="style4">·<a href="&#12289;"><?=substrs($zjfy_item['title'],58)?></a></span></td>
                      </tr>
       <?php
         }
         ?>

  相关解决方案