我有一張名爲currency_country的表,它包含所有貨幣。一些歐洲國家也有舊貨幣。我想從歐元國家的所有非歐元貨幣中刪除?如何刪除MySQL中計數大於1的貨幣?
我試過這些方法,但沒有幫助!
DELETE FROM `currency_country`
WHERE currency_code NOT IN (
SELECT currency_code
FROM (
SELECT currency_code
FROM `currency_country`
WHERE currency_code = 'EUR'
) temp
);
這
DELETE
FROM
`currency_country`
LEFT JOIN
country
on `currency_country`.`country_id` = country.`id`
WHERE
EXISTS
(
SELECT
*
FROM
`currency_country`
WHERE
EXISTS
(
SELECT
*
FROM
`currency_country`
WHERE
`currency_code` = 'EUR'
)
)
AND currency_code != 'EUR'
AND country.name IN
(
'Austria',
'Belgium',
'Cyprus',
'Netherlands',
'Estonia',
'Finland',
'France',
'Germany',
'Greece',
'Ireland',
'Italy',
'Latvia',
'Lithuania',
'Luxembourg',
'Malta',
'Monaco',
'Portugal',
'San Marino',
'Slovakia',
'Slovenia',
'Spain'
)
;
'DELETE FROM currency_country WHERE COUNTRY_ID IN(SELECT COUNTRY_ID FROM currency_country WHERE CURRENCY_CODE = 'EUR')AND CURRENCY_CODE <> 'EUR'' – ctwheels