PDA

View Full Version : Some Sql issues =(


Axiverse
05-28-2009, 03:17 AM
can you guys help me with these two statements?

this doesn't work because i'm on mysql 4. are there any alternatives for it?

INSERT INTO tags (tag_word, tag_count)
VALUES ('apple', 1), ('orange', 1), ('blueberry', 1)
ON DUPLICATE KEY UPDATE tag_count = tag_count + 1


and i don't know why this one doesn't work. I've even written it in two different ways =(


UPDATE tags
SET tag_count = tag_count - 1
WHERE tag_identifier
IN ( SELECT tag_identifier
FROM dealtags
WHERE deal_identifier = 0)


or alternative


UPDATE strappt_tags
SET tag_count = tags.tag_count - 1
FROM tags, dealtags
WHERE dealtags.tag_identifier = tags.tag_identifier
AND deal_identifier = ?


thanks!

Fumigator
05-28-2009, 06:18 PM
this one doesn't work

Care to give us the error?

i'm on mysql 4

Upgrade already, for pity sake.

Old Pedant
05-28-2009, 10:26 PM
Last code makes no sense. You are upating one table after JOINing two completely unrelated tables.

Not surprising that the middle one doesn't work in MYSQL 4.