SQL for several values ​​of the specified sort field

2011-09-06  来源:本站原创  分类:Database  人气:120 

-- On this word, we should make sense , Hei Hei
order by (case  Field when' of Beijing ' then 1 when ' Shanghai ' then 2 else 0 end)
相关文章
  • SQL for several values ​​of the specified sort field 2011-09-06

    -- On this word, we should make sense , Hei Hei order by (case Field when' of Beijing ' then 1 when ' Shanghai ' then 2 else 0 end)

  • An SQL insert multiple values ​​approach 2011-07-08

    Data in an SQL insert multiple ways: MySql Database: insert into test_table (tid, bid) values ​​(17,4), (17,6) Oracle Database: insert into test_table (tid, bid) select 17,4 from dual union select 17,6 from dual

  • SQLServer 2008中SQL增强之一:Values新用途 2014-12-22

    SQL Server 2008中新增功能:可以使用单个Insert命令插入多行 Create table Demo_Values (PKID int not null identity(1,1) primary key ,DName Nvarchar(20) null ,DCode NVarchar(30) null ,DDate datetime null ) go --this SQL is only for SQL Server 2008 Insert into Demo_Values (

  • sql remove duplicate values 2011-01-06

    CREATE TABLE [dbo]. [HQEW] ( [ID] [bigint] NOT NULL, [Supplier] [varchar] (200) NULL, [Manufacturers] [varchar] (50) NULL, [Model] [varchar] (50) NULL, [Inventory] [varchar] (50) NULL, [Address] [varchar] (50) NULL, [Environment] [varchar] (50) NULL,

  • JAVA processing time - java.sql.Date.java.util.Date in the Date field in the database conversion method 2010-03-29

    1, how java.util.Date into a java.sql.Date? Transformation: java.sql.Date sd; java.util.Date ud; / / initialize the ud such as ud = new java.util.Date (); sd = new java.sql.Date (ud.getTime ()); 2, if you want to insert into the database and the corr

  • Sort field type conversion in mysql 2011-08-15

    Server_id table is a varchar type field, and now we want to query data about server_id row order, sort the results: select server_id from cardserver where game_id = 1 order by server_id desc limit 10; +-----------+ | Server_id | +-----------+ | 8 | |

  • oracle sequence of value group sort field after 2011-09-13

    Table Name: mytable -- Use sql statement , No temporary tables, stored procedures update (select id,SORT from mytable) a set a.SORT=( select temp_sort from (select id,SCORE, row_number() OVER(PARTITION BY NAME ORDER BY SCORE DESC) temp_sort from myta

  • Oracle SQL Developer shows how to make the date field contains the time 2010-08-21

    1. Through the Tools of the Preference menu item, open the Preference window. 2. Open the left of the directory tree in the Database, select the NLS 3. To set the format of the right of the Date Format: DD-MON-RR will be revised as DD-MON-RR HH24: MI

  • sql server 2005 query all tables and table field column. type and length 2010-10-28

    Command needs to be higher today, I am responsible for all of the tables to the information summarized has been making a good format to word document. I am so lazy, like to think so much the table, so many fields, and each table to see every field to

  • sql server 2005 query all tables and table field column. the type of length 2010-10-28

    The information summarized in the database table to have developed a good word document format. For example: -------------------------------------------------- ----------------------------- select dbo.sysobjects.name as Table_name, dbo.syscolumns.nam

  • sql replace the specified characters in the text field 2010-11-04

    - Text can not be directly replaced - Mbody target field is not update b_mail set mbody = replace (convert (varchar (max), mbody), '_viewstate', 'viewstate') where mno = 124 <script type="text/javascript"> </ script>

  • Solrj - Solr super client 2010-07-12

    Solr is an independent enterprise search application server, which offers similar Web-service outside of the API interfaces. Users can http request, submitted to the search engines server a certain format XML file generated index; can also search thr

  • Founding principles index 2010-07-21

    Database design based on reasonable, after careful thought to index the table is the basis for access to high-performance database systems. The analysis is not reasonable to add an index, it will reduce the overall system performance. Although the in

  • [Transfer] Oracle.DB2.SQLSERVER.Mysql.Access page sort SQL statements 2010-11-20

    http://www.blogjava.net/fanyingjie/archive/2010/09/28/333108.html Oracle, DB2, SQLSERVER, Mysql, Access paging SQL statement to sort out recently usually used in the project summary to the sql database the next page. We can put the paging more effici

  • Fields with null values ​​sort table 2011-06-19

    Field during the sorting table, if the sort field contains null, the possible need to contain null data in the table data is arranged in the first or last question for oracle and mysql can use the following method. orcale used in order by order_col [

  • SQL operations - Memo 2010-03-02

    Mssql statement following statement in part, can not be used in access. SQL Category: DDL-Data Definition Language (CREATE, ALTER, DROP, DECLARE) DML-Data Manipulation Language (SELECT, DELETE, UPDATE, INSERT) DCL-Data Control Language (GRANT, REVOKE

  • Common SQL statements 2010-03-13

    SQL Category: DDL-Data Definition Language (CREATE, ALTER, DROP, DECLARE) DML-Data Manipulation Language (SELECT, DELETE, UPDATE, INSERT) DCL-Data Control Language (GRANT, REVOKE, COMMIT, ROLLBACK) First, a brief description based on the statement: 1

  • oracle character set and sort data 2010-03-22

    Rare today, a little time to practice a bit on the oracle database character set and sort the relevant order, hereby order out for later use. SQL> select * from v$nls_valid_values where parameter='CHARACTERSET' order by 2; PARAMETER VALUE -----------

  • Complete SQL operation 2010-03-25

    Mssql statement following statement in part, can not be used in access. SQL Category: DDL-Data Definition Language (CREATE, ALTER, DROP, DECLARE) DML-Data Manipulation Language (SELECT, DELETE, UPDATE, INSERT) DCL-Data Control Language (GRANT, REVOKE

  • Experience in SQL optimization 2010-03-26

    Not only do we have to write SQL, but make sure to write good performance SQL, the following is the author study, extract, and summarize some of the information to share with you! (1) Select the most efficient sequence table name (only the effective