Visualizzazione dei risultati da 1 a 6 su 6

Discussione: Solo tramite SQL??

  1. #1

    Solo tramite SQL??

    Ragazzi ho circa 30.000 record con le e-mail scritte in questo modo: patate@miodominio.it

    Devo sostituire @ con la @. Posso fare il tutto solo in sql senza per forza fare un str_replace in php??

    grazie

  2. #2

    Re: Solo tramite SQL??

    Originariamente inviato da massimo80
    Ragazzi ho circa 30.000 record con le e-mail scritte in questo modo: patate@miodominio.it

    Devo sostituire @ con la @. Posso fare il tutto solo in sql senza per forza fare un str_replace in php??

    grazie

    scusa mi ha preso i caratteri in modo non corretto.

    devo sostituire
    Codice PHP:
    @ 
    con @

  3. #3
    Utente di HTML.it
    Registrato dal
    May 2003
    Messaggi
    591
    da manuale mysql:
    ....
    REPLACE(str,from_str,to_str)
    Returns the string str with all occurrences of the string from_str replaced by
    the string to_str:
    mysql> SELECT REPLACE('www.mysql.com', 'w', 'Ww');
    -> 'WwWwWw.mysql.com'
    This function is multi-byte safe.

    .....
    per cui si puoi solo con sql.
    inoltre ti può essere di aiuto ...

    INSTR(str,substr)
    Returns the position of the first occurrence of substring substr in string str.
    This is the same as the two-argument form of LOCATE(), except that the arguments
    are swapped:
    mysql> SELECT INSTR('foobarbar', 'bar');
    -> 4
    mysql> SELECT INSTR('xbar', 'foobar');
    -> 0
    This function is multi-byte safe. In MySQL 3.23 this function is case sensitive,
    while in 4.0 it’s only case sensitive if either argument is a binary string.

  4. #4
    Scusate se mi intrometto...ma l' argomento mi interessa ed essendo veramente scarso in sql ne approfitto...

    se ho una tabella così:

    codice:
              TABLE_1
    +-----+--------+------------+
    | id  | campo1 |    data    |
    +---------------------------+
    |  1  |  onno  | 0000-00-00 |
    |---------------------------|
    |  2  |  moro  | 0000-00-00 |
    |---------------------------|
    |  3  |  dono  | 0000-00-00 |
    +---------------------------+
    come faccio ad ottenere (in SQL):
    codice:
     
              TABLE_1
    +-----+--------+------------+
    | id  | campo1 |    data    |
    +---------------------------+
    |  1  |  AnnA  | 0000-00-00 |
    |---------------------------|
    |  2  |  mArA  | 0000-00-00 |
    |---------------------------|
    |  3  |  dAnA  | 0000-00-00 |
    +---------------------------+
    www.bitmade.com Momentan ist richtig_Momentan ist gut_Nicht ist wirklich wichtig_Nach der Ebbe kommt die Flut_ _Am Strand des Lebens_ohne Grund,ohne Verstand_ist nichts vergebens_ich baue di traeume auf den Sand.

  5. #5
    Utente di HTML.it
    Registrato dal
    May 2003
    Messaggi
    591
    update `table_1` set campo1=replace(campo1,'o','A')

  6. #6
    (mi sento idiota)
    Grazie 1000!
    www.bitmade.com Momentan ist richtig_Momentan ist gut_Nicht ist wirklich wichtig_Nach der Ebbe kommt die Flut_ _Am Strand des Lebens_ohne Grund,ohne Verstand_ist nichts vergebens_ich baue di traeume auf den Sand.

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.