根据文本SQL查询的一部分获取唯一字段

时间:2014-02-28 06:11:07

标签: mysql sql oracle mysql-workbench

我有一个场景,我需要根据文本字段的一部分获取唯一字段。我们来看看这个例子。

select payload from system_metrics where category like "%action_controller%" ;

我将获取数据

 payload                                                                                                                                                                                                                                                                                                                                                                                                           |
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| ---
:path: /
:method: GET
:params:
  controller: home
  action: index
:db_runtime: 0.507614
:view_runtime: 24.756144
:end_point: HomeController#index
                                                                                                                                                                                                                                                            |
| ---
:path: /api/tags?access_token=313fcd2b3ea05ff4807f848a921d5105
:method: GET
:params:
  access_token: 313fcd2b3ea05ff4807f848a921d5105
  format: json
  action: index
  controller: api/v1/tags
:db_runtime: 1.5405440000000001
:view_runtime: 1.4430399999999999
:end_point: Api::V1::TagsController#index
                                                                                                   |
| ---
:path: /api/skills?access_token=313fcd2b3ea05ff4807f848a921d5105&page_no=1&page_size=10
:method: GET
:params:
  access_token: 313fcd2b3ea05ff4807f848a921d5105
  page_no: '1'
  page_size: '10'
  format: json
  action: index
  controller: api/v1/skills
:db_runtime: 1.328608
:view_runtime: 1.7736150000000004
:end_point: Api::V1::SkillsController#index
                                               |
| ---
:path: /api/tags?access_token=313fcd2b3ea05ff4807f848a921d5105
:method: GET
:params:
  access_token: 313fcd2b3ea05ff4807f848a921d5105
  format: json
  action: index
  controller: api/v1/tags
:db_runtime: 3.4335250000000004
:view_runtime: 1.536743
:end_point: Api::V1::TagsController#index
                                                                                                             |
| ---
:path: /api/users/notifications
:method: GET
:params:
  format: json
  action: notifications
  controller: api/v1/users
:db_runtime: 1.1296910000000002
:view_runtime: 3.0749649999999997
:end_point: Api::V1::UsersController#notifications
                                                                                                                                                                 |
| ---
:path: /api/tags?access_token=313fcd2b3ea05ff4807f848a921d5105
:method: GET
:params:
  access_token: 313fcd2b3ea05ff4807f848a921d5105
  format: json
  action: index
  controller: api/v1/tags
:db_runtime: 0.6034980000000001
:view_runtime: 1.88346
:end_point: Api::V1::TagsController#index
                                                                                                              |
| ---
:path: /api/roles
:method: GET
:params:
  format: json
  action: index
  controller: api/v1/roles
:db_runtime: 1.005604
:view_runtime: 40.49389600000001
:end_point: Api::V1::RolesController#index
                                                                                                                                                                                                          |
| ---
:path: /api/entities?auth_token=313fcd2b3ea05ff4807f848a921d5105
:method: GET
:params:
  auth_token: 313fcd2b3ea05ff4807f848a921d5105
  format: json
  action: index
  controller: api/v1/entities
:db_runtime: 4.905517
:view_runtime: 0.400314
:end_point: Api::V1::EntitiesController#index

有效负载每个都有这样的文本

:path: /
:method: GET
:params:
  controller: home
  action: index
:db_runtime: 0.507614
:view_runtime: 24.756144
:end_point: HomeController#index

我需要获得唯一的palyload,其中“ end_point:”是唯一的

HomeController #index是存在的,所以我不应该重复nxt时间...

那个查询是什么?????????????????????

1 个答案:

答案 0 :(得分:0)

我认为不可能。由于数据似乎是一种结构化的方式。如果数据类型相似或保持适当的结构,那么我们就可以做到这一点。我们无法从列数据中提取任意子字符串。详细了解sub-string