我正在重建一个搜索查询,因为它在“我所看到的”中变得多余,我想知道什么
(albums_artists, Artists) ()加入吗?是为了提高性能吗?
使用简单内连接的查询,使用旧的 (SQL-89) 隐式连接语法:
SELECT
ma_users.name,
ma_users.username,
albums.id AS album_id,
albums.upc,
albums.name AS album_name,
albums.status,
albuminfos.label,
DATE_FORMAT(albums.created, '%Y-%m-%d') AS created_date,
CONCAT(artists.name) AS artist_name,
COUNT(tracks.id) AS total_tracks,
albumstatus.description AS album_status
FROM albums, albuminfos, ma_users , (albums_artists, artists) , tracks ,(albumstatus, albumtypes)
WHERE
albums.id = albuminfos.id
AND ma_users.id = albums.account_id
AND albums.id = albums_artists.artist_id
AND albums_artists.artist_id = artists.id
AND tracks.album_id = albums.id
AND albums.status = albumstatus.id
AND albumtypes.id = albums.albumtype_id
AND albuminfos.label LIKE '%$keywords%'
GROUP BY albums.id
ORDER BY albuminfos.label
也接受我需要预期的改进和错误的意见。