去除多余DISTICT
This commit is contained in:
parent
5c2ea41a14
commit
dc80d8d527
@ -31,7 +31,10 @@ async function fetchAll({ args = {}, isUpdate = false }) {
|
|||||||
console.log("start fetching albums ...");
|
console.log("start fetching albums ...");
|
||||||
|
|
||||||
if (isUpdate) {
|
if (isUpdate) {
|
||||||
var sql = `SELECT DISTINCT album_id FROM album WHERE (full_description = '' or full_description is null) and description like '%专辑《%》,简介:%' and description not regexp '^.*?专辑《.*?》,简介:[:space:]*?。,更多.*$'`;
|
var sql = `
|
||||||
|
-- SELECT DISTINCT album_id FROM album WHERE (full_description = '' or full_description is null) and description like '%专辑《%》,简介:%' and description not regexp '^.*?专辑《.*?》,简介:[:space:]*?。,更多.*$'
|
||||||
|
SELECT album_id FROM album WHERE (full_description = '' or full_description is null) and description like '%专辑《%》,简介:%' and description not regexp '^.*?专辑《.*?》,简介:[:space:]*?。,更多.*$'
|
||||||
|
`;
|
||||||
} else {
|
} else {
|
||||||
let whereClause = [
|
let whereClause = [
|
||||||
args.min ? `album_id > ${args.min}` : '1=1',
|
args.min ? `album_id > ${args.min}` : '1=1',
|
||||||
|
@ -8,14 +8,13 @@ const dbUtils = global.dbUtils;
|
|||||||
|
|
||||||
// 从数据库中查出还缺少的歌词,并进行爬取
|
// 从数据库中查出还缺少的歌词,并进行爬取
|
||||||
async function fetchAll({ args = {} }) {
|
async function fetchAll({ args = {} }) {
|
||||||
if (args.order) console.log("存在 DISTINCT,自动升序排序,无需指定ORDER BY");
|
|
||||||
console.log("start fetching lyrics ...");
|
console.log("start fetching lyrics ...");
|
||||||
let whereClause = [
|
let whereClause = [
|
||||||
args.min ? `song_id > ${args.min}` : '1=1',
|
args.min ? `song_id > ${args.min}` : '1=1',
|
||||||
args.max ? `song_id <= ${args.max}` : '1=1',
|
args.max ? `song_id <= ${args.max}` : '1=1',
|
||||||
].join(' AND ');
|
].join(' AND ');
|
||||||
var sql = `
|
var sql = `
|
||||||
SELECT DISTINCT song_id FROM song WHERE ${whereClause} AND song_id NOT IN ( SELECT song_id FROM lyric )
|
SELECT song_id FROM song WHERE ${whereClause} AND song_id NOT IN ( SELECT song_id FROM lyric )
|
||||||
${args.limit ? `LIMIT ${args.limit}` : ''}
|
${args.limit ? `LIMIT ${args.limit}` : ''}
|
||||||
`;
|
`;
|
||||||
console.log(sql);
|
console.log(sql);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user