小编Sha*_*dow的帖子

使用 substr 和 like 运算符的区别

SELECT SUBSTR(gram_panchayat,1,6) GP FROM tw_master WHERE gram_panchayat LIKE 'B%';

SELECT gram_panchayat FROM tw_master WHERE gram_panchayat LIKE 'B_____';
Run Code Online (Sandbox Code Playgroud)

这两个选择语句有什么区别。

sql oracle oracle11g

0
推荐指数
1
解决办法
74
查看次数

将值与列中的范围值匹配

我有一个包含列注册年份的表,其值类似于“2017-2019”和“2014-2016”。

如果我的输入值为 2018,那么我的 SQL 查询将用于获取“2017-2019”之间的记录。

ID 注册年份
1 2014-2016
2 2017-2019

上面是数据库表,我的输入是2018。那么它应该返回id 2。

我的 sql 查询是什么?提前致谢

sql django

0
推荐指数
1
解决办法
103
查看次数

在我的测试文件(spec.js)中上传本地服务器和端点时出错

我有以下问题:

我正在使用 Cypress 进行自动化测试。我创建了一个本地服务器,一个端点,我总是需要在测试之前启动并在测试之后始终关闭。

我尝试了一种方法,但出现以下错误:

Error: Webpack Compilation Error
./node_modules/mysql2/node_modules/lru-cache/dist/mjs/index.js 51:11
Module parse failed: Unexpected character '#' (51:11)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|      length;
|      private constructor
>     static #constructing = false;
|     static create(max) {
|         const HeapCls = getUintArray(max);
 @ ./node_modules/mysql2/lib/parsers/parser_cache.js 3:12-32
 @ ./node_modules/mysql2/promise.js
Run Code Online (Sandbox Code Playgroud)

有谁能够帮助我?

我上传到服务器的文件(index.js):

const express = require("express");
const app = express();
const port = 3000;
const programmingLanguagesRouter …
Run Code Online (Sandbox Code Playgroud)

javascript automated-tests mysql2 cypress

0
推荐指数
1
解决办法
84
查看次数

MySQl使用COUNT和CASE语句

在我的mysql数据库中,我有instagram_actions_histories带有两个重要列的表as action_typeaction_name,现在我想使用count和case语句获取ids列的计数,例如:

等于和等于“喜欢” id时所有s的计数action_type1action_name

select `account_id`,

count(case when action_type = 1 and action_name='like' then id else 0 END) as `like`,
count(case when action_type = 1 and action_name='superLike' then id else 0 END) as `superLike`,
count(case when action_type = 2 then id else 0 END) as `follow`, 

from `instagram_actions_histories` 
where `instagram_actions_histories`.`account_id` in (1) 
group by `account_id`
Run Code Online (Sandbox Code Playgroud)

不幸的是我得到错误的结果,因为所有输出都是相同的,例如:

account_id  like    superLike    follow
1           1282    1282         1282
Run Code Online (Sandbox Code Playgroud)

正确的结果应该是:

account_id  like    superLike    follow …
Run Code Online (Sandbox Code Playgroud)

mysql sql

-1
推荐指数
1
解决办法
1140
查看次数

如何将逗号分隔的字符串值转换为 MySQL 中的行?

我在 MySQL 中有一列返回逗号分隔值,我想将该列转换为行。

更好的答案是如何将逗号分隔的参数转换为 mysql 中的行?

select value from table limit 1

回复

价值
本田,activa,快乐,汽车

我希望这个值像这样排列

价值
本田
激活
乐趣

mysql recursive-query

-2
推荐指数
1
解决办法
4271
查看次数