+ -
当前位置:首页 → 问答吧 → mysql中怎么批量导入和批量删除???

mysql中怎么批量导入和批量删除???

时间:2010-06-02

来源:互联网

代码:
+-----------------------------------------------+--------------------+
| name                                          | parent_category_id |
+-----------------------------------------------+--------------------+
| Contents                                      |                  0 |
| Geographic                                    |                  0 |
| GeometryCollection properties                 |                  1 |
| Geometry constructors                         |                 31 |
| Geometry properties                           |                 31 |
| Geometry relations                            |                 31 |
| LineString properties                         |                 31 |
| MBR                                           |                 31 |
| Point properties                              |                 31 |
| Polygon properties                            |                 31 |
| WKB                                           |                 31 |
| WKT                                           |                 31 |
| Account Management                            |                 32 |
| Administration                                |                 32 |
| Compound Statements                           |                 32 |
| Data Definition                               |                 32 |
| Data Manipulation                             |                 32 |
| Data Types                                    |                 32 |
| Functions                                     |                 32 |
| Functions and Modifiers for Use with GROUP BY |                 32 |
| Geographic Features                           |                 32 |
| Language Structure                            |                 32 |
| Table Maintenance                             |                 32 |
| Transactions                                  |                 32 |
| User-Defined Functions                        |                 32 |
| Utility                                       |                 32 |
| Bit Functions                                 |                 35 |
| Comparison operators                          |                 35 |
| Control flow functions                        |                 35 |
| Date and Time Functions                       |                 35 |
| Encryption Functions                          |                 35 |
| Information Functions                         |                 35 |
| Logical operators                             |                 35 |
| Miscellaneous Functions                       |                 35 |
| Numeric Functions                             |                 35 |
| String Functions                              |                 35 |
+-----------------------------------------------+--------------------+


name列取第一个字符,并分组count. 把count数大于等于3的那个字母对应的数据(即以这个字符开头的数据)全部输出来.
表是用的mysql中的help_category数据表.

作者: rufen   发布时间: 2010-06-02

没有明白楼主的意思。

作者: shinery   发布时间: 2010-06-02

代码:
select * from help_category where left(name,1) in (select left(name,1) from help_category group by left(name,1) having count(parent_category_id) > 2 ) order by left(name,1);

试出来了 o(∩_∩)o...哈哈

作者: rufen   发布时间: 2010-06-02

代码:
+------------------+-------------------------------+--------------------+-----+
| help_category_id | name                          | parent_category_id | url |
+------------------+-------------------------------+--------------------+-----+
|                6 | Control flow functions        |                 35 |     |
|               32 | Contents                      |                  0 |     |
|               16 | Comparison operators          |                 35 |     |
|               21 | Compound Statements           |                 32 |     |
|               36 | Data Definition               |                 32 |     |
|               25 | Data Manipulation             |                 32 |     |
|               29 | Date and Time Functions       |                 35 |     |
|               19 | Data Types                    |                 32 |     |
|               31 | Geographic Features           |                 32 |     |
|               33 | Geometry properties           |                 31 |     |
|               28 | Geometry relations            |                 31 |     |
|               23 | GeometryCollection properties |                  1 |     |
|               22 | Geometry constructors         |                 31 |     |
|                1 | Geographic                    |                  0 |     |
|               27 | Language Structure            |                 32 |     |
|               12 | Logical operators             |                 35 |     |
|               11 | LineString properties         |                 31 |     |
+------------------+-------------------------------+--------------------+-----+

结果如上

作者: rufen   发布时间: 2010-06-02

select * from help_category where substr(name, 1,1 ) in (select substr(name, 1, 1) FROM help_category group by substr(name, 1, 1) having count(substr(name, 1, 1) ) >= 3)

作者: tingjie   发布时间: 2010-06-02

牛叉,执行这样一条语句要多少时间

作者: shinery   发布时间: 2010-06-02

学习下

作者: gzbao9999   发布时间: 2010-07-16

学习了

作者: baicai271   发布时间: 2010-07-23