MySQL Forums
Forum List  »  Italian

Aiuto Query SQL
Posted by: seingh haccoski
Date: November 06, 2011 06:08AM

Ho questa query SQL:
INSERT INTO forums (
id, nome, descrizione, subsection
) SELECT fid as id,
name as nome,
description as descrizione, (
SPLIT_STR(
parentlist, ",", 1
)
) as subsection from mybb_forums



ove SPLIT_STR equivale a questa funzione SQL:
CREATE FUNCTION SPLIT_STR(
x VARCHAR(255),
delim VARCHAR(12),
pos INT
)
RETURNS VARCHAR(255)
RETURN REPLACE(SUBSTRING(SUBSTRING_INDEX(x, delim, pos),
LENGTH(SUBSTRING_INDEX(x, delim, pos -1)) + 1),
delim, '');




e devo fare in modo che se SPLIT_STR(parentlist, ",", 1) ritorna "1" deve scrivere "0" altrimenti deve scrivere il valore ritornato...
come posso fare?

Options: ReplyQuote


Subject
Views
Written By
Posted
Aiuto Query SQL
3120
November 06, 2011 06:08AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.