1
0
Code Issues Pull Requests Projects Releases Wiki Activity GitHub Gitee

去掉 NOT IN 之后子查询的 DISTINCT

This commit is contained in:
程序员小墨 2022-10-05 12:06:44 +08:00
parent b35918faef
commit 6c3a6d9aaf
3 changed files with 3 additions and 3 deletions

View File

@ -30,7 +30,7 @@ async function fetchAll({ isUpdate = false }) {
console.log("start fetching albums ...") console.log("start fetching albums ...")
var albumIds = await dbUtils.query(isUpdate var albumIds = await dbUtils.query(isUpdate
? `SELECT DISTINCT album_id FROM album WHERE (full_description = '' or full_description is null) and description like '%专辑《%》,简介:%' and description not regexp '^.*?专辑《.*?》,简介:[:space:]*?。,更多.*$'` ? `SELECT DISTINCT album_id FROM album WHERE (full_description = '' or full_description is null) and description like '%专辑《%》,简介:%' and description not regexp '^.*?专辑《.*?》,简介:[:space:]*?。,更多.*$'`
: `SELECT DISTINCT album_id FROM song_album_relation WHERE album_id NOT IN ( SELECT DISTINCT album_id FROM album )`, []); : `SELECT DISTINCT album_id FROM song_album_relation WHERE album_id NOT IN ( SELECT album_id FROM album )`, []);
albumIds = albumIds.map(item => item.album_id); albumIds = albumIds.map(item => item.album_id);
for (let i = 0; i < albumIds.length; i++) { for (let i = 0; i < albumIds.length; i++) {
await global.checkIsExit(); await global.checkIsExit();

View File

@ -25,7 +25,7 @@ async function getFromDatabase({ artistId }) {
async function fetchAll() { async function fetchAll() {
console.log("start fetching artists ...") console.log("start fetching artists ...")
var artistIds = await dbUtils.query(` var artistIds = await dbUtils.query(`
SELECT DISTINCT artist_id FROM song_artist_relation WHERE artist_id NOT IN ( SELECT DISTINCT artist_id FROM artist ) SELECT DISTINCT artist_id FROM song_artist_relation WHERE artist_id NOT IN ( SELECT artist_id FROM artist )
`, []); `, []);
artistIds = artistIds.map(item => item.artist_id); artistIds = artistIds.map(item => item.artist_id);
for (let i = 0; i < artistIds.length; i++) { for (let i = 0; i < artistIds.length; i++) {

View File

@ -10,7 +10,7 @@ const dbUtils = global.dbUtils;
async function fetchAll() { async function fetchAll() {
console.log("start fetching lyrics ..."); console.log("start fetching lyrics ...");
var songIds = await dbUtils.query(` var songIds = await dbUtils.query(`
SELECT DISTINCT song_id FROM song WHERE song_id NOT IN ( SELECT DISTINCT song_id FROM lyric ) SELECT DISTINCT song_id FROM song WHERE song_id NOT IN ( SELECT song_id FROM lyric )
`, []); `, []);
songIds = songIds.map(song => song.song_id); songIds = songIds.map(song => song.song_id);
for (let i = 0; i < songIds.length; i++) { for (let i = 0; i < songIds.length; i++) {