samuel157
/root
- Joined
- Mar 19, 2010
- Messages
- 518
- Solutions
- 3
- Reaction score
- 71
- Location
- São Paulo, Brazil
- GitHub
- Samuel10M
UPDATE players SET name = TRIM(SUBSTR(name, LENGTH('[Vip]') + 1)) WHERE name LIKE '[Vip]%';
[Vip]
) so you could try with:UPDATE players p
LEFT JOIN players p2 ON p2.name = TRIM(SUBSTR(p.name, LENGTH('[Vip]') + 1))
SET p.name = TRIM(SUBSTR(p.name, LENGTH('[Vip]') + 1))
WHERE p.name LIKE '[Vip]%' AND p2.name IS NULL;
SELECT p2.name
FROM players p
INNER JOIN players p2 ON p2.name = TRIM(SUBSTR(p.name, LENGTH('[Vip]') + 1))
WHERE p.name LIKE '[Vip]%'
if isPremium(cid) then
function EddyHavoc(cid)
if isPlayer(cid) then
db.executeQuery("UPDATE `players` SET `name` = '"..string.sub(getCreatureName(cid), 7).."' WHERE `id` = "..getPlayerGUID(cid)..";")
doRemoveCreature(cid)
end
end
if string.find(tostring(getCreatureName(cid)),"[[Vip]]") then
else
local name = getCreatureName(cid)
db.executeQuery("UPDATE `players` SET `name` = '[Vip] "..name.."' WHERE `id` = "..getPlayerGUID(cid)..";")
doRemoveCreature(cid)
end
elseif (not (isPremium)) and string.find(tostring(getCreatureName(cid)),"[[Vip]]") then
addEvent(EddyHavoc, 3*1000, cid)
end
function EddyHavoc(cid)
if isPlayer(cid) then
db.executeQuery("UPDATE `players` SET `name` = '" .. string.sub(getCreatureName(cid), 7) .. "' WHERE `id` = " .. getPlayerGUID(cid) .. ";")
doRemoveCreature(cid)
end
end
if string.find(tostring(getCreatureName(cid)), "[[Vip]]") then
local name = getCreatureName(cid)
db.executeQuery("UPDATE `players` SET `name` = '[Vip] " .. name .. "' WHERE `id` = " .. getPlayerGUID(cid) .. ";")
doRemoveCreature(cid)
end
Quanto ao SQLite, esse tipo de consulta não é suportado, tente lidar com esses casos manualmente (duplicados), para obter uma lista deles:
SQL:SELECT p2.name FROM players p INNER JOIN players p2 ON p2.name = TRIM(SUBSTR(p.name, LENGTH('[Vip]') + 1)) WHERE p.name LIKE '[Vip]%'