<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel>
        <title>MySQL Forums - Italian</title>
        <description>Forum per gli utenti MySQL di lingua Italiana.</description>
        <link>https://forums.mysql.com/list.php?129</link>
        <lastBuildDate>Fri, 10 Apr 2026 17:19:10 +0000</lastBuildDate>
        <generator>Phorum 5.2.23</generator>
        <item>
            <guid>https://forums.mysql.com/read.php?129,727315,727315#msg-727315</guid>
            <title>calo prestazioni migrazione da Mysql 5.7 (2 replies)</title>
            <link>https://forums.mysql.com/read.php?129,727315,727315#msg-727315</link>
            <description><![CDATA[ Buongiorno,<br />
ho problema di prestazioni in seguito ad una migrazione da MYSQL 5.7.16 su MYSQL 8.4.0.<br />
My sql 8.4.0 è installato su un windows server 2022 e anche la precedente versione 5.7 era su windows.<br />
Il database è utilizzato da un’applicazione web che ha avuto un forte calo di prestazioni. Premetto che il sistema non è ancora in produzione e l’unica persona che sta utilizzando il database sono io.<br />
L’applicazione web viene eseguita da IIS a 32 bit ed utilizza il driver “MySQL ODBC 8.0 Ansi Driver”<br />
<br />
Riporto i test eseguiti e anomalie indentificate<br />
<br />
1.	Riavviato servizio mysql per partire da una base efficiente<br />
2.	Eseguo direttamente da workbench 1 query di selezione abbastanza complessa: tempo di esecuzione 13 sec circa. Ci può stare perché è la prima volta che viene eseguita.<br />
3.	Rieseguo la stessa query in workbench: tempo di esecuzione: 0.47 secondi.<br />
4.	Navigo nell’app web e noto già una lentezza<br />
5.	Rieseguo la stessa query in workbench: tempo di esecuzione: 0.47 secondi.<br />
6.	Navigo in una pagina specifica che esegue una query di selezione simile a quella eseguita al punto 2<br />
7.	Rieseguo la stessa query in workbench: tempo di esecuzione: 12 secondi. Questa query che aveva un tempo di 0.47 secondi è salita a 12 secondi e i suoi tempi di esecuzioni non si abbassano più finchè non riavvio il servizio mysql<br />
<br />
Ho controllato con “process list” se ci fossero dei lock, ma niente.<br />
<br />
Riporto anche il valore di alcune variabili configurate:<br />
innodb_buffer_pool_size: 4294967296<br />
innodb_log_buffer_size: 16777216<br />
innodb_flush_log_at_trx_commit: 1<br />
innodb_buffer_pool_bytes_data: 4147019776<br />
<br />
Monitorando lo status del server con mysql workbench su MySql 8.4 vedo &quot;key efficient 0%&quot;, mentre su Mysql 5.7 vedo &quot;key efficient 100%&quot;. Come mai? Ho migrato le stesse chiavi. Forse il problema è questo?<br />
<br />
Potete aiutarmi a capire come poter risolvere questi problemi di lentezza?]]></description>
            <dc:creator>Diana B.</dc:creator>
            <category>Italian</category>
            <pubDate>Tue, 15 Apr 2025 16:21:16 +0000</pubDate>
        </item>
        <item>
            <guid>https://forums.mysql.com/read.php?129,724686,724686#msg-724686</guid>
            <title>L&#039;ordinamento DESC non funziona (no replies)</title>
            <link>https://forums.mysql.com/read.php?129,724686,724686#msg-724686</link>
            <description><![CDATA[ Salve,<br />
sto provando a invertire la sequenza dell&#039;output di una query con ASC, ma continua sempre a presentarmi i risultati in ordine decrescente.<br />
Questa la query:<br />
<br />
SELECT *, ( 3959 * acos ( cos ( radians(38.764086) ) * cos( radians(latitude ) ) * cos( radians(longitude ) - radians(16.199074) ) + sin ( radians(38.764086) ) * sin( radians(latitude ) ) ) ) AS distance FROM banner HAVING distance &lt; 0.3 ORDER BY &#039;index&#039; ASC<br />
<br />
Nulla cambia se metto DESC.<br />
<br />
Cosa ho sbagliato?<br />
<br />
Grazie, Fabrizio]]></description>
            <dc:creator>Fabrizio Bartolomucci</dc:creator>
            <category>Italian</category>
            <pubDate>Fri, 07 Jun 2024 07:42:38 +0000</pubDate>
        </item>
        <item>
            <guid>https://forums.mysql.com/read.php?129,724376,724376#msg-724376</guid>
            <title>Aiuto risoluzione query progett (no replies)</title>
            <link>https://forums.mysql.com/read.php?129,724376,724376#msg-724376</link>
            <description><![CDATA[ Salve a tutti, sto avendo problemi a risolvere una query che mi è stata assegnata dal professore per un progetto universitario. <br />
<br />
nel progetto in questione stiamo simulando la creazione di un database per gestire i piani di volo. abbiamo gia realizzato i modelli concettuali e ristrutturati, ed abbiamo anche gia realizzato il diagramma su mysql. <br />
la query ci chiede: dati due voli di linea e rispettive rotte, si riportino il numero di zone condivise dalle rotte dei due voli. <br />
a tal proposito, abbiamo suddiviso la zona geografica in tnati quadranti, e supposto che ogni quadrante formasse una zona, con un suo codice identificativo.<br />
abbiamo creato, tra le altre, due tabelle in particolare per questa query: <br />
<br />
tabella VOLO DI LINEA, contenente tutte le info per i voli, tabella che poi è stata collegata alla tabella ROTTA, per cui anche la chiave di ogni rotta è presente all&#039;interno della tabella dei voli; <br />
tabella ROTTA, che contiene un suo id, il numero di zone attraversate(in termini di quantità), ed i codici zona, a tal proposito, siccome una rotta puòintersecare piu zone, ad esempio nel nostro modello il volo ROMA-MILANO <br />
attraversa una sola zona, ma il volo ROMA-LONDRA attraversa 3 zone, per cui dentro la tabella rotta ci sono piu colonne riguardanti le zone, denominate come segue: la colonna CODICE_ZONA, è NOT NULL, poichè rappresenta la zona di partenza che potrebbe coincidere con l&#039;arrivo, poi ci sono le colonne CODICE_ZONA2, CODICE_ZONA3 ecc, che possono anche essere null.<br />
<br />
come si ptrebbe scrivere la query in modo che riporti il conteggio delle zone condivise? c&#039;è da fare qualche modifica alle tabelle o agli attributi delle tabelle? <br />
riporto di seguito il codice che abbiamo creato sul qule stiamo lavorando, ovvimente cosi scritto il massimo conteggio che potrà riportare è 1, pero anche aggiungendo le uguaglianze tra tutte le possibili combinazioni dei codicizona, lavorando con or ed and, ci ha fornito sempre come risultato 1. <br />
cosa si può fare?<br />
<br />
SELECT COUNT(CASE WHEN A.CODICE_ZONA = B.CODICE_ZONA THEN 1 END ) AS ZONE<br />
FROM<br />
    (SELECT <br />
        V.VOLO_ID,<br />
            V.ROTTA_ID,<br />
            R.CODICE_ZONA,<br />
            R.CODICE_ZONA_2,<br />
            R.CODICE_ZONA_3<br />
    FROM<br />
        VOLO_DI_LINEA V<br />
    JOIN ROTTA R ON V.ROTTA_ID = R.ID<br />
    HAVING V.VOLO_ID = 4) A<br />
        JOIN<br />
    (SELECT <br />
        V.VOLO_ID,<br />
            V.ROTTA_ID,<br />
            R.CODICE_ZONA,<br />
            R.CODICE_ZONA_2,<br />
            R.CODICE_ZONA_3<br />
    FROM<br />
        VOLO_DI_LINEA V<br />
    JOIN ROTTA R ON V.ROTTA_ID = R.ID<br />
    HAVING V.VOLO_ID = 2) B ON A.CODICE_ZONA = B.CODICE_ZONA]]></description>
            <dc:creator>Gabriele Manfrè Poeta</dc:creator>
            <category>Italian</category>
            <pubDate>Sun, 19 May 2024 15:13:31 +0000</pubDate>
        </item>
        <item>
            <guid>https://forums.mysql.com/read.php?129,722853,722853#msg-722853</guid>
            <title>recupero dati tavola (no replies)</title>
            <link>https://forums.mysql.com/read.php?129,722853,722853#msg-722853</link>
            <description><![CDATA[ salve su un server com mysql 8 c&#039;e&#039; stato seganlato un errore , verificando i log ho trovato questo<br />
[ERROR] [MY-013134] [Server] Table &#039;NomeTavola&#039; is marked as crashed and last (automatic?) repair failed<br />
Non avendo  un backup , ho fatto la copia della cartella del db e ho provato a fare &#039;repair table &quot;tavola&quot; &quot; e anche ha lanciare myisamchk -r &quot;tavola&quot; , il risultato ottenuto e&#039; lo stesso , da una tavola molto grossa , mi ritorna un tavola con un solo record , se guardo i file prima e dopo le operazioni le differenze sono enormi .<br />
Dispomgo dei bin log ma non ho mai fatto operazioni su di essi , sapete se posso utilizzarli per recuperare i dati della tavola?<br />
Oppure c&#039;e&#039;  un modo per estrarre i dati dal file &quot;tavola.MYD&quot; la mia paura e&#039; che il campo `image` longblob NOT NULL, possa essere il vero problema.]]></description>
            <dc:creator>Andrea Bo</dc:creator>
            <category>Italian</category>
            <pubDate>Sat, 17 Feb 2024 10:55:21 +0000</pubDate>
        </item>
        <item>
            <guid>https://forums.mysql.com/read.php?129,712097,712097#msg-712097</guid>
            <title>Aiuto per query (no replies)</title>
            <link>https://forums.mysql.com/read.php?129,712097,712097#msg-712097</link>
            <description><![CDATA[ Buonasera a tutte/i avrei bisogno di aiuto per una query su una singola tabella<br />
nome tabella: qso<br />
campi: nome,banda<br />
<br />
banda può assumere solo i seguenti valori (ma non è interessante credo):<br />
<br />
&#039;2200M&#039;,&#039;630M&#039;,&#039;160M&#039;,&#039;80M&#039;,&#039;60M&#039;,&#039;40M&#039;,&#039;30M&#039;,&#039;20M&#039;,&#039;17M&#039;,&#039;15M&#039;,&#039;12M&#039;,&#039;10M&#039;,&#039;8M&#039;,&#039;6M&#039;,&#039;2M&#039;,&#039;1.25M&#039;,&#039;70CM&#039;,&#039;33CM&#039;,&#039;23CM&#039;,&#039;13CM&#039;,&#039;5CM&#039;,&#039;3CM&#039;<br />
<br />
vorrei tirar fuori, mettendo una clausola su nome (eg nome=&#039;michele&#039;) tutte le occorrenze di nome avente banda esistente e non esistente nella tabella (magari ritorna 0 o 1 in base alla presenza).<br />
Ad esempio un valore banda è presente per altri nomi differenti per nome ma io lo voglio comunque vedere per &quot;michele&quot;<br />
<br />
esempio:<br />
<br />
nome   banda<br />
pippo   20m<br />
pippo   40m<br />
pippo   10m<br />
michele 30m<br />
michele 10m<br />
paperin 60m<br />
<br />
vorrei vedere per michele un risultato così (o qualcosa di simile):<br />
<br />
banda   presente<br />
10m        1<br />
20m        0<br />
30m        1<br />
40m        0<br />
60m        0<br />
<br />
ovvero...le bande presenti intutta la tabella (senza distinzione di nome) sono 10m,20m,30m,40m   ma  michele è presente solo con 10m,30m  e non presente con 20m,40m<br />
<br />
presente ho scritto 1 o 0 ma va bene qualsiasi cosa tipo &quot;si&quot; &quot;no&quot;,tanto quando itero sui record me li maneggio io.<br />
<br />
Idee?<br />
<br />
Grazie infinite per l&#039;attenzione]]></description>
            <dc:creator>Michele Paperino</dc:creator>
            <category>Italian</category>
            <pubDate>Tue, 19 Dec 2023 17:46:47 +0000</pubDate>
        </item>
        <item>
            <guid>https://forums.mysql.com/read.php?129,710679,710679#msg-710679</guid>
            <title>MYSQL LOST CONNECTION (no replies)</title>
            <link>https://forums.mysql.com/read.php?129,710679,710679#msg-710679</link>
            <description><![CDATA[ Buongiorno a tutti<br />
<br />
Avrei bisogno di risolvere un problema; premessa il server MySQL è installato su un AS400...<br />
Avrei la necessita di copiare i dati di una vista AS su una tabella del Server MySql e la classica INSERT INTO tabella... SELECT FROM vista, funziona _quasi correttamente_...<br />
nel senso che 2 volte su 3 non funziona al primo colpo; se la eseguo, mi va in &quot;mysql lost connection&quot; e se la rilancio nel giro di qualche secondo, viene eseguita in maniera corretta<br />
Questa cosa poi dovrei passarla come Events... e chiaramente non funziona fino a quando non risolvo quel problema di lost connection<br />
<br />
I record da spostare non sono tantissimi... al momento circa 700.000 record con 26 campi... ma probabilmente &quot;tirare su la vista&quot; da AS, fa perdere la connessione...<br />
<br />
Qualcuno mi sa&#039; dare qualche suggerimento?<br />
<br />
Grazie.]]></description>
            <dc:creator>Roberto Bertoldo</dc:creator>
            <category>Italian</category>
            <pubDate>Sun, 19 Nov 2023 16:31:11 +0000</pubDate>
        </item>
        <item>
            <guid>https://forums.mysql.com/read.php?129,710407,710407#msg-710407</guid>
            <title>Aiuto per query (no replies)</title>
            <link>https://forums.mysql.com/read.php?129,710407,710407#msg-710407</link>
            <description><![CDATA[ Ho bisogno di incrementare tutti i valori del campo ID di una tabella tab_export di 150.<br />
Perciò la riga in cui è 10 deve diventare 160, quella in cui è 25 deve diventare 175, ecc...<br />
<br />
Non sono pratico di mySQL, avrei bisogno della query da inserire su phpmyadmin<br />
<br />
Grazie]]></description>
            <dc:creator>Renzo Merelli</dc:creator>
            <category>Italian</category>
            <pubDate>Sat, 04 Nov 2023 10:36:51 +0000</pubDate>
        </item>
        <item>
            <guid>https://forums.mysql.com/read.php?129,709355,709355#msg-709355</guid>
            <title>Crittografare intero Database (no replies)</title>
            <link>https://forums.mysql.com/read.php?129,709355,709355#msg-709355</link>
            <description><![CDATA[ Buongiorno, vorrei crittografare un intero database.<br />
Leggo che il comando da fornire, in fase di creazione, è : CREATE SCHEMA db1 DEFAULT ENCRYPTION=&#039;y&#039;;<br />
A questo punto il Database viene generato.<br />
E ora?<br />
Cioe, presumo che oltre al fatto che sia crittografato si aspetti che venga immessa una password di decriptazione cosicchè nella SELECT delle tabelle generate all&#039;interno di questo Database venga indicata anche questa password.<br />
Ma non mi sembra che la cosa funzioni in questo modo.<br />
Chiedo gentilmente se qualcuno possa dirmi a cosa serva criptare un intero database se non esistono i presupposti che ho indicato.<br />
Grazie<br />
Saluti]]></description>
            <dc:creator>Daniele Riefoli</dc:creator>
            <category>Italian</category>
            <pubDate>Sun, 25 Jun 2023 10:03:42 +0000</pubDate>
        </item>
        <item>
            <guid>https://forums.mysql.com/read.php?129,709133,709133#msg-709133</guid>
            <title>Errore connessione ODBC verso VPS con DB mysql (no replies)</title>
            <link>https://forums.mysql.com/read.php?129,709133,709133#msg-709133</link>
            <description><![CDATA[ buongiorno a tutti 😊<br />
non sono un esperto di mysql, ma ho un DB su un vps al quale con excel e connessione odbc aggiorno una tabella che mi serve.<br />
Ho cambiato pc (con win 11) e non riesco più a collegare odbc al DB su vps, qualcuno riesce a darmi una mano a capire cosa mi manca nella configurazione ? (detto che ho copiato pari pari tutto dal pc vecchio con win 10) ?<br />
ho configurato anche il tunnel in putty (perchè non saprei aprirlo qua in excel)<br />
l&#039;errore che mi mostra è il seguente:<br />
<br />
Connection failed with the following error:<br />
[MYSQL][ODBC 8.0(w) driver]Access denied for user &#039;root&#039;@&#039;79.xxx&#039; (using passowrd: YES)[HY000]<br />
<br />
non so che IP sia quello che dice in questa strinfa, il VPS ha tutto un altro ip.<br />
<br />
qualcuno mi riesce a capire cosa devo far per farlo accedere e quindi aggiornare la mia tabella Excel ?<br />
grazie a tutti]]></description>
            <dc:creator>Simone Villa</dc:creator>
            <category>Italian</category>
            <pubDate>Wed, 31 May 2023 10:07:14 +0000</pubDate>
        </item>
        <item>
            <guid>https://forums.mysql.com/read.php?129,708813,708813#msg-708813</guid>
            <title>Aiuto per query (no replies)</title>
            <link>https://forums.mysql.com/read.php?129,708813,708813#msg-708813</link>
            <description><![CDATA[ Buongiorno,<br />
grazie a chi saprà darmi una mano.<br />
<br />
Ho una tabella di questo tipo:<br />
<br />
__________________________________________<br />
DATA        |     VALORI    |     TIPO   <br />
__________________________________________<br />
2023-01-01  |      val1     |    Tipo1<br />
__________________________________________<br />
2023-01-01  |      val2     |    Tipo2<br />
__________________________________________<br />
2023-01-01  |      val3     |    Tipo3<br />
__________________________________________<br />
2023-01-02  |      val4     |    Tipo1<br />
__________________________________________<br />
2023-01-02  |      val5     |    Tipo2<br />
__________________________________________<br />
2023-01-02  |      val6     |    Tipo3<br />
__________________________________________<br />
<br />
e così di seguito<br />
<br />
<br />
Vorrei realizzare una query che mi realizzi questa tabella:<br />
<br />
<br />
DATA        |                  VALORI    <br />
_____________________________________________________<br />
2023-01-01  |   (val1 * A) + (val2 * B) +  (val3 * C) <br />
_____________________________________________________<br />
2023-01-02  |   (val4 * A) + (val5 * B) +  (val5 * C) <br />
<br />
Dove A, B, C sono 3 costanti e andando a &quot;pescare&quot; i valori in base al tipo.<br />
<br />
Potete aiutarmi?<br />
Grazie]]></description>
            <dc:creator>panix panix</dc:creator>
            <category>Italian</category>
            <pubDate>Fri, 21 Apr 2023 09:55:04 +0000</pubDate>
        </item>
        <item>
            <guid>https://forums.mysql.com/read.php?129,707541,707541#msg-707541</guid>
            <title>Ordinare una campo stringa in una query (no replies)</title>
            <link>https://forums.mysql.com/read.php?129,707541,707541#msg-707541</link>
            <description><![CDATA[ Ciao a tutti <br />
<br />
ho un problema ma forse è di facile soluzione.<br />
<br />
Ho un campo che posso formattare raggruppando come voglio e al cui interno ho bisogno di mettere più valori separati da un separator.<br />
<br />
All&#039;interno di questo campo ho bisogno di ordinare i valori sull&#039;item select.<br />
<br />
in pratica Select campo1,campo2, campo3 from tabella<br />
<br />
nel campo3 ho &quot;c-a-b&quot; ed ho bisogno di ordinarli <br />
c&#039;è una funzione che fa al caso mio ?<br />
<br />
Grazie in anticipo a chi vuole aiutarmi.<br />
Un saluto]]></description>
            <dc:creator>Sergio Barozzi</dc:creator>
            <category>Italian</category>
            <pubDate>Wed, 22 Feb 2023 13:14:55 +0000</pubDate>
        </item>
        <item>
            <guid>https://forums.mysql.com/read.php?129,707137,707137#msg-707137</guid>
            <title>config.php ricevo un fatal error (1 reply)</title>
            <link>https://forums.mysql.com/read.php?129,707137,707137#msg-707137</link>
            <description><![CDATA[ Ciao a tutti sono Roberto, <br />
<br />
Ho un problema riguardo il PREFIX del mio database, <br />
<br />
Ho questo file chiamato config.php è al suo interno ho inserito i miei dati come: user - nome - password - host. in più mi chiede obbligatoriamente il PREFIX, <br />
<br />
Quando inserisco i dati corretti, salvo il file, avvio un altro file col nome install.php<br />
<br />
<br />
Ricevo un errore. <br />
--------------------------------------------------------------------<br />
Fatal error: Uncaught mysqli_sql_exception: Access denied for user &#039;super25_frsuper25&#039;@&#039;10.27.5.5&#039; (using password: YES) in /customers/2/6/d/super25.fr/httpd.www/LM/db.php:35<br />
Stack trace:<br />
#0 /customers/2/6/d/super25.fr/httpd.www/LM/db.php(35): mysqli-&gt;__construct(&#039;localhost&#039;, &#039;super25_frsuper...&#039;, Object(SensitiveParameterValue), &#039;super25_frsuper...&#039;)<br />
#1 /customers/2/6/d/super25.fr/httpd.www/LM/db.php(19): db-&gt;__construct()<br />
#2 /customers/2/6/d/super25.fr/httpd.www/LM/install.php(10): db::getInstance()<br />
#3 {main}<br />
  thrown in /customers/2/6/d/super25.fr/httpd.www/LM/db.php on line 35<br />
---------------------------------------------------------------------<br />
Mi pottete aiutare a capire qual&#039;è l&#039;errore?<br />
<br />
<br />
Vi ringrazio in anticipo.]]></description>
            <dc:creator>Roberto Cabras</dc:creator>
            <category>Italian</category>
            <pubDate>Wed, 04 Jan 2023 10:01:20 +0000</pubDate>
        </item>
        <item>
            <guid>https://forums.mysql.com/read.php?129,706553,706553#msg-706553</guid>
            <title>Mysql 5.7 Query Annidate ed estrazioni campi (1 reply)</title>
            <link>https://forums.mysql.com/read.php?129,706553,706553#msg-706553</link>
            <description><![CDATA[ Salve a tutti descrivo il mio problema.<br />
Ho tre tabelle :<br />
Clienti - CodiceCliente,Nominativo etc..<br />
Ordini - CodiceCliente, DataOrdine,Importo<br />
Query_Totali - CodiceCliente, TotaleOrdini, NumeroOrdini<br />
<br />
query_Ordini in realtà è una vista già salvata all&#039;interno del db<br />
<br />
Supponiamo che interroghi dalla Data D1 alla Data D2, vorrei ottenere questo :<br />
<br />
CodiceCliente,Nominativo, ImportoParziale, NumeroOrdiniParziale, TotaleOrdini,NumeroOrdini<br />
<br />
dove ImportoParziale, NumeroOrdiniParziale sono i valori dalla data D1 alla data D2<br />
<br />
E&#039; possibili ottenere un&#039;interrogazione del genere ?<br />
Ovviamente potrei anche interrogare per esempio Importo &gt;10, oppure tutti quelli che si chiamano Paolo.<br />
<br />
Spero di essermi spiegato.<br />
Grazie a tutti]]></description>
            <dc:creator>Mario Rossi</dc:creator>
            <category>Italian</category>
            <pubDate>Sun, 23 Oct 2022 09:09:04 +0000</pubDate>
        </item>
        <item>
            <guid>https://forums.mysql.com/read.php?129,705301,705301#msg-705301</guid>
            <title>Errore ERROR 1580 (HY000): You cannot &#039;DROP&#039; a log table if logging is enabled (4 replies)</title>
            <link>https://forums.mysql.com/read.php?129,705301,705301#msg-705301</link>
            <description><![CDATA[ Ciao a tutti, ho server mysql 5.6 e quando tento di importare un file SQL di backup mi da l&#039;errore in oggetto, cioè:<br />
<br />
ERROR 1580 (HY000): You cannot &#039;DROP&#039; a log table if logging is enabled<br />
<br />
Non riesco a venirne fuori....mi date una mano a risolvere?<br />
<br />
Grazie infinite<br />
<br />
F]]></description>
            <dc:creator>francesco di maio</dc:creator>
            <category>Italian</category>
            <pubDate>Sat, 16 Jul 2022 05:09:18 +0000</pubDate>
        </item>
        <item>
            <guid>https://forums.mysql.com/read.php?129,704761,704761#msg-704761</guid>
            <title>migrazione con Mysql Migration Toolkit (2 replies)</title>
            <link>https://forums.mysql.com/read.php?129,704761,704761#msg-704761</link>
            <description><![CDATA[ Buongiorno a tutti, ho il seguente problema:<br />
In Microsoft Access ho una tabella clienti con un campo città (testo 100)<br />
una tabella a parte citta (testo100) con il campo citta (primary key)<br />
una relazione 1 a molti fra campo citta della tabella città e campo citta della tabella clienti con ONDELETE RESTRICT e ONUPDATE CASCADE<br />
<br />
durante l&#039;importazione in mysql di questo database con mysql migration toolkit non ha importato la tabella citta quindi l&#039;ho ricreata manualmente in mysql con le stesse caratteristiche indicate sopra campo citta primarykey<br />
<br />
quando cerco di creare la stessa relazione selezionando la tabella citta fra i campi citta delle due tabelle mysql mi restituisce il seguente messaggio<br />
<br />
Cannot add or update a child row: a foreign key constraint fails (`sharedmdb`.`#sql-5320_10d`, CONSTRAINT `vincoloclienti` FOREIGN KEY (`citta`) REFERENCES `clienti` (`citta`) ON UPDATE CASCADE)<br />
<br />
sbaglio qualcosa? è forse obbligatorio l&#039;utilizzo di un campo ID per le relazioni oppure è possibile creare relazioni anche fra campi di testo dei quali uno dei due campi di testo è primarykey?<br />
<br />
grazie a tutti.]]></description>
            <dc:creator>Paolo Coltrini</dc:creator>
            <category>Italian</category>
            <pubDate>Fri, 15 Jul 2022 14:12:12 +0000</pubDate>
        </item>
        <item>
            <guid>https://forums.mysql.com/read.php?129,704305,704305#msg-704305</guid>
            <title>Vista per stampa etichette (no replies)</title>
            <link>https://forums.mysql.com/read.php?129,704305,704305#msg-704305</link>
            <description><![CDATA[ Ciao a tutti,<br />
<br />
ho bisogno del Vs. aiuto per creare una vista che leggendo da una tabella che contiene un codice e una quantità (semplifico per chiarezza) con dati di questo tipo:<br />
<br />
     Codice    Qta<br />
     --------  -----<br />
     CODICE1       3<br />
     CODICE2       5<br />
     CODICE3       2<br />
<br />
mi estragga dei record con questo aspetto<br />
<br />
     Codice    Qta<br />
     --------  -----<br />
     CODICE1       1<br />
     CODICE1       1<br />
     CODICE1       1<br />
     CODICE2       1<br />
     CODICE2       1<br />
     CODICE2       1<br />
     CODICE2       1<br />
     CODICE2       1<br />
     CODICE3       1<br />
     CODICE3       1   <br />
<br />
In pratica voglio ottenere un numeri di righe per ogni codice pari al numero indicato nel campo qta.<br />
<br />
Ho trovato questa query per SQL Server, ma su MySQL non funziona. Se ho visto bene, non esiste la tabella master e non trovo una sua equivalente<br />
<br />
Select id = row_number() over (partition by A.id order by N)<br />
,CodiceArticolo<br />
,Quantita = 1<br />
From Dettagli A<br />
Join (<br />
Select N=Row_Number() Over (Order By (Select NULL))<br />
From master.dbo.spt_values n1 ,master.dbo.spt_values n2<br />
) B on N &lt;= A.Quantita<br />
<br />
Qualcuno sa come posso risolvere?<br />
<br />
Grazie<br />
Marcello]]></description>
            <dc:creator>Marcello Mela</dc:creator>
            <category>Italian</category>
            <pubDate>Fri, 06 May 2022 18:08:21 +0000</pubDate>
        </item>
        <item>
            <guid>https://forums.mysql.com/read.php?129,704266,704266#msg-704266</guid>
            <title>Creazione tabelle gestione magazzino (no replies)</title>
            <link>https://forums.mysql.com/read.php?129,704266,704266#msg-704266</link>
            <description><![CDATA[ Salve a tutti , premetto di essere neofita sull&#039;argomento mysql.<br />
Vorrei creare un database  che mi permetta di effettuare alcune operazioni :<br />
in effetti il database l&#039;ho pensato cosi:<br />
<br />
- CATEGORIE contenete i campi id_categoria , nome_categoria<br />
<br />
- CLIENTI contenente i campi id_cliente , nome , cognome , codice_fiscale , codice_verifica , scad_piano_terapeutico<br />
<br />
- PRESIDI contenente i campi id_presidio , id_categoria , nome_presidio , quantita<br />
<br />
- EROGAZIONI contenente i campi id_erogazione, id_presidio , id_cliente , data_erogazione , stato_erogazione<br />
<br />
le chiavi primarie sono : id_categoria , id_cliente , id_presidio id_erogazione<br />
<br />
i campi nome_categoria , nome , cognome, codife_fiscale , codice_verifica , scad_piano_terapeutico , nome_presidio , quantità , data_erogazione , stato_erogazione sono tutti NOT NULL <br />
<br />
Mi chiedo se va bene questo tipo di impostazione premettendo che dalla tabella cosi impostata saranno erogati mensilmente i presidi e dalla stessa mi occorrerebbe ottenere dei report riguardanti:<br />
- il numero di presidi totali erogati mensilmente<br />
- le erogazioni per ogni cliente sia annuali che mensili<br />
<br />
Qualche consiglio in merito ?<br />
Grazie anticipatamente]]></description>
            <dc:creator>Nicola Antignano</dc:creator>
            <category>Italian</category>
            <pubDate>Thu, 05 May 2022 10:35:11 +0000</pubDate>
        </item>
        <item>
            <guid>https://forums.mysql.com/read.php?129,704047,704047#msg-704047</guid>
            <title>Log connessione (no replies)</title>
            <link>https://forums.mysql.com/read.php?129,704047,704047#msg-704047</link>
            <description><![CDATA[ Buongiorno a tutti, sto imparando da poco ad usare MySQL, mi servirebbe sapere se è possibile abilitare delle log aggiuntive, in modo che io possa vedere ogni tentativo di connessione che viene effettuato al server MySQL e anche le connessioni riuscite, come posso fare?<br />
Grazie mille a tutti]]></description>
            <dc:creator>Daniele Parasporo</dc:creator>
            <category>Italian</category>
            <pubDate>Wed, 20 Apr 2022 09:35:32 +0000</pubDate>
        </item>
        <item>
            <guid>https://forums.mysql.com/read.php?129,703774,703774#msg-703774</guid>
            <title>Mi presento (no replies)</title>
            <link>https://forums.mysql.com/read.php?129,703774,703774#msg-703774</link>
            <description><![CDATA[ Buongiorno,<br />
mi chiamo Riccardo e attualmente sono disoccupato.<br />
Vorrei imparare il mestiere di amministratore di sistema linux e mi sto confrontando con l&#039;istallazione di mysql su centos 8, sto avendo dei problemi :), spero che in questo forum trovero&#039; persone che hanno piacere di aiutarmi.<br />
<br />
I miei hobbi sono:<br />
gioco a World of warcraft<br />
vado a camminare <br />
tango argentino (che attualmente ho lasciato per via della pandemia) <br />
cinema<br />
musica,<br />
scacchi<br />
<br />
Saluti]]></description>
            <dc:creator>Riccardo Susca</dc:creator>
            <category>Italian</category>
            <pubDate>Mon, 04 Apr 2022 06:48:42 +0000</pubDate>
        </item>
        <item>
            <guid>https://forums.mysql.com/read.php?129,703537,703537#msg-703537</guid>
            <title>Query da più tabelle (no replies)</title>
            <link>https://forums.mysql.com/read.php?129,703537,703537#msg-703537</link>
            <description><![CDATA[ Buongiorno a tutti...<br />
<br />
Premetto che sono un semiprincipiante per quanto riguarda mysql, nel senso che ho un po&#039; di dimestichezza ma con le cose più semplice 😅<br />
<br />
Ho un problema con una query un po complessa ovvero devo estrapolate dei dati da 4 tabelle.<br />
<br />
Mi spiego meglio:<br />
<br />
Ho una tabella clienti, con relativi dati dei miei clienti;<br />
<br />
Ho una tabella macchine, con relativi dati della macchina e una chiave esterna che indica di chi è la macchina(id_cliente per intenderci) ;<br />
<br />
Ho una tabella utente, con relativi dati degli utenti che utilizzano le macchine;<br />
<br />
Infine ho una tabella operazioni, dove all&#039;interno ho :<br />
<br />
Id_operazione<br />
Data operazione<br />
Materiale inserito<br />
Id_utente<br />
Id_macchina<br />
<br />
Io devo recuperare la lista di tutti gli utenti che hanno generato delle operazioni, numero di operazioni e la somma del materiale inserito Totale di tutte le operazioni fatte, il tutto relativamente alle macchine possedute da un cliente e in determinato lasso di tempo.<br />
<br />
Riesco a recuperare la lista degli utenti, riesco a recuperare la lista delle operazioni e riesco a recuperare la somma, ma tutto separatamente. Come posso fare ad avere una query che mi restituisca il tutto?!<br />
<br />
Grazie a tutti quelli che mi sapranno dare una mano visto che sto impazzendo da giorni.]]></description>
            <dc:creator>Fabrizio Sereni</dc:creator>
            <category>Italian</category>
            <pubDate>Sat, 19 Mar 2022 15:48:21 +0000</pubDate>
        </item>
        <item>
            <guid>https://forums.mysql.com/read.php?129,700419,700419#msg-700419</guid>
            <title>creazione non voluta dei campi createdAt e updatedAt (1 reply)</title>
            <link>https://forums.mysql.com/read.php?129,700419,700419#msg-700419</link>
            <description><![CDATA[ Ho uno strano problema utilizzando mysql con Nodejs.<br />
NelModel ho definito le classi impostando il parametro &quot;underscored: 0&quot;.<br />
riporto ad esempio la classe &quot;user&quot;<br />
<br />
module.exports = (sequelize, Sequelize) =&gt; {<br />
    const User = sequelize.define(&quot;users&quot;, {<br />
      id:{<br />
            // Sequelize module has INTEGER Data_Type.<br />
          type:Sequelize.INTEGER,<br />
          underscored: 0,<br />
    <br />
          // To increment user_id automatically.<br />
          autoIncrement:true,<br />
    <br />
          // user_id can not be null.<br />
          allowNull:false,<br />
    <br />
          // For uniquely identify user.<br />
          primaryKey:true<br />
          <br />
      },<br />
      cognome: {<br />
        type: Sequelize.STRING,<br />
        underscored: 0<br />
      },<br />
      nome: {<br />
        type: Sequelize.STRING,<br />
        underscored: 0<br />
      },<br />
      idStato: {<br />
        type: Sequelize.INTEGER,<br />
        underscored: 0<br />
      },<br />
      username: {<br />
        type: Sequelize.STRING,<br />
        underscored: 0<br />
      },<br />
      password: {<br />
        type: Sequelize.STRING,<br />
        underscored: 0<br />
      },      <br />
      email: {<br />
        type: Sequelize.STRING,<br />
        underscored: 0<br />
      },<br />
      idRuolo: {<br />
        type: Sequelize.INTEGER,<br />
        underscored: 0<br />
      },<br />
      idRuolo_Day: {<br />
        type: Sequelize.INTEGER,<br />
        underscored: 0<br />
      },<br />
      noteutente: {<br />
        type: Sequelize.STRING,<br />
        underscored: 0<br />
      },<br />
      photo: {<br />
        type: Sequelize.STRING,<br />
        underscored: 0<br />
      },<br />
      remember_token: {<br />
        type: Sequelize.STRING,<br />
        underscored: 0<br />
      },<br />
      email_verified_at: {<br />
        type: Sequelize.DATE,<br />
        underscored: 0<br />
      },<br />
      key_utenti_operation: {<br />
        type: Sequelize.INTEGER,<br />
        underscored: 0<br />
      },<br />
      created_at: {<br />
        type: Sequelize.DATE,<br />
        underscored: 0<br />
      },<br />
      updated_at: {<br />
        type: Sequelize.DATE,<br />
        underscored: 0<br />
      },<br />
     },{<br />
        timestamps: true,<br />
        underscored: 0,<br />
        freezeTableName: true,<br />
      });<br />
  <br />
    return User;<br />
  };<br />
<br />
nel authcontroller utilizzo il metodo &quot;login&quot; per verificare le credenziali<br />
<br />
exports.login = (req, res) =&gt; {<br />
    User.findOne({<br />
      where: {<br />
        email: req.body.username<br />
      }<br />
    })<br />
      .then(user =&gt; {<br />
        if (!user) {<br />
          return res.status(404).send({ message: &quot;username inesistente&quot; });<br />
        }<br />
  <br />
        var passwordIsValid = bcrypt.compareSync(<br />
          req.body.password,<br />
          user.password<br />
        );<br />
  <br />
        if (!passwordIsValid) {<br />
          return res.status(401).send({<br />
            accessToken: null,<br />
            message: &quot;Invalid Password!&quot;<br />
          });<br />
        }<br />
  <br />
        var token1 = jwt.sign({ id: user.id }, config.secret, {<br />
          expiresIn: expiresToken  // 86400 // 24 hours<br />
        });<br />
  <br />
<br />
    <br />
        const data = JSON.stringify(user);<br />
        console.log(&#039;backend - login ---  data&#039; + data);<br />
        var token = jwt.sign({data}, config.secret, {<br />
          expiresIn: config.expiresIn // 24 hours<br />
        })<br />
   <br />
<br />
        //  attenzione accessToken deve essere valorizzato co token1<br />
<br />
<br />
<br />
<br />
        res.status(200).send({<br />
            id: user.id,<br />
            username: user.username,<br />
            cognome: user.cognome,<br />
            user_ruolo: user.idruolo_day,<br />
            idruoloweb: user.idruolo_day,<br />
            email: user.email,<br />
            accessToken: token,<br />
            token_type: &#039;bearer&#039;,<br />
            expires_in: expiresToken<br />
          });<br />
      })<br />
      .catch(err =&gt; {<br />
        res.status(500).send({ message: err.message });<br />
      });<br />
  };<br />
<br />
<br />
quando eseguo  &quot;User.findOne&quot; viene generata la strnga sql con la select da eseguire.<br />
<br />
il codice generato è il seguente<br />
<br />
Executing (default): SELECT `id`, `cognome`, `nome`, `idStato`, `username`, `password`, `email`, `idRuolo`, `idRuolo_Day`, `noteutente`, `photo`, `remember_token`, `email_verified_at`, `key_utenti_operation`, `created_at`, `updated_at`, `createdAt`, `updatedAt` FROM `users` AS `users` WHERE `users`.`username` = &#039;misonsan&#039; LIMIT 1;<br />
<br />
Viene generato aggiungendo impropriamente anche i campi <br />
 `createdAt` e `updatedAt` che NON ESISTONO NEL Database<br />
<br />
la struttura dei campi per la tabella users nel database è la seguente<br />
<br />
CREATE TABLE `users` (<br />
`id` int(4) NOT NULL,<br />
`cognome` varchar(32) DEFAULT NULL,<br />
`nome` varchar(32) DEFAULT NULL,<br />
`photo` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT &#039;0.jpg&#039;,<br />
`idStato` int(1) DEFAULT &#039;0&#039;,<br />
`tipoacc` int(1) NOT NULL DEFAULT &#039;0&#039; COMMENT &#039;tipoacc = 0 acc. provvisoria senza foto\r\ntipoacc = 1 acc. definitiva con upload foto\r\n\r\n&#039;,<br />
`username` varchar(32) DEFAULT NULL,<br />
`password` varchar(100) DEFAULT NULL,<br />
`email` varchar(40) DEFAULT NULL,<br />
`idRuolo` int(2) NOT NULL DEFAULT &#039;0&#039;,<br />
`idRuolo_Day` int(2) NOT NULL DEFAULT &#039;0&#039;,<br />
`idruoloweb` int(2) NOT NULL DEFAULT &#039;0&#039; COMMENT &#039;tabella T_ruolo_web&#039;,<br />
`noteUtente` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,<br />
`eseguitaAbilitazione` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT &#039;N&#039;,<br />
`remember_token` varchar(100) DEFAULT NULL,<br />
`email_verified_at` timestamp NULL DEFAULT NULL,<br />
`key_utenti_operation` int(4) DEFAULT &#039;0&#039;,<br />
`created_at` timestamp NULL DEFAULT NULL,<br />
`updated_at` timestamp NULL DEFAULT NULL<br />
) ENGINE=InnoDB DEFAULT CHARSET=utf8; <br />
<br />
quindi i campi createdAt e updatedAt NON ESISTONO.<br />
<br />
come posso risolvere il problema potendo generare la strnga sql da far eseguire senza i campi createdAt e updatedAt che NON ESISTONO ?<br />
<br />
Sicuramente è un parametro da valorizzare, ma non so dove intervenire ?<br />
<br />
Grazie<br />
<br />
Moreno]]></description>
            <dc:creator>moreno moreno</dc:creator>
            <category>Italian</category>
            <pubDate>Fri, 31 Dec 2021 15:58:31 +0000</pubDate>
        </item>
        <item>
            <guid>https://forums.mysql.com/read.php?129,700116,700116#msg-700116</guid>
            <title>SELECT SUM(column) ORDER BY SUM(column) (1 reply)</title>
            <link>https://forums.mysql.com/read.php?129,700116,700116#msg-700116</link>
            <description><![CDATA[ Hi All,<br />
hoping to find All You Well.<br />
I have a problem in making a ranking query of the tracks that have sold the most...<br />
My db have also a column &#039;converted&#039; and I would like to find the TOP TEN SUM(converted) GROUP BY another column &#039;catalog&#039;.<br />
Any suggestion ?<br />
thanks<br />
Gio]]></description>
            <dc:creator>Giorgio Canepa</dc:creator>
            <category>Italian</category>
            <pubDate>Tue, 07 Dec 2021 16:29:55 +0000</pubDate>
        </item>
        <item>
            <guid>https://forums.mysql.com/read.php?129,700038,700038#msg-700038</guid>
            <title>Il cursore non funziona correttamente (1 reply)</title>
            <link>https://forums.mysql.com/read.php?129,700038,700038#msg-700038</link>
            <description><![CDATA[ Salve a tutti. Ho un altro strano problema. Ho una stored con un cursore dichiarato così:<br />
<br />
	DECLARE CONTINUE HANDLER FOR NOT FOUND SET finished = 1;<br />
<br />
	CREATE TEMPORARY TABLE NewsTable (ID INT, Immagine NVARCHAR(255), Titolo LONGTEXT);<br />
    <br />
    BEGIN<br />
		DECLARE NewsCursor CURSOR FOR SELECT news.ID, news.Immagine, news.Titolo, news.Sottotitolo, news.Body FROM news;<br />
<br />
		OPEN NewsCursor;<br />
<br />
		NEWSLOOP: LOOP<br />
			FETCH NewsCursor INTO id, immagine, titolo, sottotitolo, body;<br />
			<br />
			IF finished = 1 THEN<br />
				LEAVE NEWSLOOP;<br />
			END IF;<br />
<br />
			INSERT INTO NewsTable (ID, Immagine, Titolo) SELECT id AS ID, immagine AS IMMAGINE, titolo AS TITOLO;<br />
			INSERT INTO NewsTable (ID, Immagine, Titolo) SELECT 0 AS ID, &#039;&#039; AS IMMAGINE, sottotitolo AS TITOLO;<br />
			INSERT INTO NewsTable (ID, Immagine, Titolo) SELECT 0 AS ID, &#039;&#039; AS IMMAGINE, body AS TITOLO;<br />
		END LOOP;<br />
<br />
		CLOSE NewsCursor;<br />
	END;<br />
<br />
	SELECT ID, Immagine, Titolo FROM NewsTable;<br />
<br />
Viene fuori il numero di record corretto (18 righe), ma ogni record è uguale all&#039;altro, con i dati dell&#039;ultimo record della tabella a cui punta il cursore (news).<br />
Cosa sbaglio? Perché il FETCH tira fuori solo i dati dell&#039;ultimo record di &quot;news&quot;?]]></description>
            <dc:creator>Pietro Torrente</dc:creator>
            <category>Italian</category>
            <pubDate>Fri, 03 Dec 2021 12:06:54 +0000</pubDate>
        </item>
        <item>
            <guid>https://forums.mysql.com/read.php?129,699993,699993#msg-699993</guid>
            <title>count(*) non funziona... (2 replies)</title>
            <link>https://forums.mysql.com/read.php?129,699993,699993#msg-699993</link>
            <description><![CDATA[ Ciao a tutti. Ho creato una stored procedure come segue:<br />
<br />
CREATE DEFINER=`root`@`localhost` PROCEDURE [procedure_name](<br />
    idaccount int,<br />
    data NVARCHAR(10)<br />
)<br />
BEGIN<br />
<br />
    IF idaccount IS NULL THEN<br />
        SELECT count(*) INTO @counter FROM [table_sample]<br />
        WHERE DATE_FORMAT(STR_TO_DATE(DataInizio, &#039;%d/%m/%Y&#039;), &#039;%d/%m/%Y&#039;) &gt;= DATE_FORMAT(STR_TO_DATE(data, &#039;%d/%m/%Y&#039;), &#039;%d/%m/%Y&#039;) ORDER BY DataInizio DESC;<br />
   ELSE<br />
        SELECT count(*) INTO @counter FROM [table_sample]<br />
        WHERE IDAccount = idaccount AND DATE_FORMAT(STR_TO_DATE(DataInizio, &#039;%d/%m/%Y&#039;), &#039;%d/%m/%Y&#039;) &gt;= DATE_FORMAT(STR_TO_DATE(data, &#039;%d/%m/%Y&#039;), &#039;%d/%m/%Y&#039;) ORDER BY DataInizio DESC;<br />
   END IF;<br />
    <br />
    SELECT @counter;<br />
    <br />
...<br />
<br />
Mi dite perché @counter è sempre 0, quando dovrebbe restituire 6, dato che nella tabella [table_sample] ci sono 6 records?<br />
Anche se metto [schema].[table_sample] il risultato è sempre 0. Perché? Cosa sbaglio?<br />
Grazie!]]></description>
            <dc:creator>Pietro Torrente</dc:creator>
            <category>Italian</category>
            <pubDate>Fri, 03 Dec 2021 11:20:45 +0000</pubDate>
        </item>
        <item>
            <guid>https://forums.mysql.com/read.php?129,699756,699756#msg-699756</guid>
            <title>aggiornare i link dei prodotti (no replies)</title>
            <link>https://forums.mysql.com/read.php?129,699756,699756#msg-699756</link>
            <description><![CDATA[ Salve a tutti<br />
ho modificato tutti i nomi dei prodotti nel mio e-commerce di prestashop;<br />
<br />
dopo varie azioni nel backoffice non riesco ad aggiornare i link dei prodotti che rimangono quelli di prima.<br />
<br />
Mi hanno consigliato di aggiornarli direttamente dal mio mysql database;<br />
<br />
il problema è che non conosco il linguaggio mysql e quindi avrei bisogno di un aiutino per creare una query per aggiornare tutta la tabella dei prodotti.<br />
<br />
saluti]]></description>
            <dc:creator>Claudio Verga</dc:creator>
            <category>Italian</category>
            <pubDate>Thu, 11 Nov 2021 07:50:49 +0000</pubDate>
        </item>
        <item>
            <guid>https://forums.mysql.com/read.php?129,699403,699403#msg-699403</guid>
            <title>select di due campi nella stessa colonna (no replies)</title>
            <link>https://forums.mysql.com/read.php?129,699403,699403#msg-699403</link>
            <description><![CDATA[ Salve volevo sapere se due campi si possono unire su una stessa colonna come output. mi spiego:<br />
<br />
SELECT (cf.cf) AS subscriber_cf,<br />
                (r.cf) AS claims_cf,<br />
                g.refunds_type as claims_type,<br />
                YEAR(documents.doc_date) AS claims_year,<br />
                SUM(documents.amount) AS claims_amount, <br />
                SUM(payments.refund_amount) AS refunds_amount <br />
                FROM cg_hs_claims c <br />
                JOIN(<br />
                	SELECT cd.claim_id, <br />
                	MIN(is_hs) AS is_hs, <br />
                	MIN(cd.doc_date) AS doc_date, <br />
                	MIN(cd.doc_date) AS min_doc_date, <br />
                	SUM(cdp.amount) AS amount<br />
                	FROM cg_hs_claim_documents_payments cdp <br />
                	JOIN cg_hs_claim_documents cd ON cd.id = cdp.document_id <br />
                	GROUP BY claim_id <br />
                ) documents ON documents.claim_id = c.id AND documents.is_hs = 0<br />
                JOIN(<br />
                	SELECT claim_id, <br />
                	SUM(refund_amount) AS refund_amount<br />
                	FROM cg_hs_claim_payments <br />
                	-- WHERE YEAR(payment_sent_date) = &#039;&quot; . $db-&gt;esc($year) . &quot;&#039; <br />
                	GROUP BY claim_id <br />
                ) payments ON payments.claim_id = c.id <br />
                JOIN cg_hs_guarantees g ON g.id = c.guarantee_id AND g.refunds_type != &#039; &#039;<br />
                JOIN cg_hs_subscribers s ON s.id = c.subscriber_id <br />
                JOIN cg_hs_companies co ON co.id = s.company_id <br />
                JOIN cg_hs_cfs cf ON cf.id = s.cf_id <br />
                LEFT JOIN cg_hs_subscriber_relatives r ON r.id = c.relative_id <br />
                WHERE c.state &gt; 0 AND co.group_id = 39<br />
                GROUP BY subscriber_cf,  claims_year <br />
                ORDER BY subscriber_cf,  claims_year;<br />
<br />
in questa select in campo claims_cf dovrebbe incolonnarsi sotto subscriber_cf per quelli che sono i cf dei maggiorenni mentre i minorenni (da calcolare come condizione) possono rimanere dove sono....spero di essermi spiegata.<br />
Grazie chi potrà aiutarmi.]]></description>
            <dc:creator>serenella angelilli</dc:creator>
            <category>Italian</category>
            <pubDate>Fri, 22 Oct 2021 13:41:09 +0000</pubDate>
        </item>
        <item>
            <guid>https://forums.mysql.com/read.php?129,699380,699380#msg-699380</guid>
            <title>Substitute LAG function (no replies)</title>
            <link>https://forums.mysql.com/read.php?129,699380,699380#msg-699380</link>
            <description><![CDATA[ Salve,<br />
avevo nel Maria DB versione 10 la seguente query. La stessa query non funziona su Mysql 5.7, perché non c&#039;è in questa versione la funzione window LAG. Come posso sostituirlo? <br />
Casistica: ricerca delle date disponibili degli impianti, anche parzialmente, tra le due date fornite dall&#039;utente. VI RINGRAZIO IN ANTICIPO.<br />
<br />
SELECT * FROM (<br />
                                  SELECT<br />
                                    id_subimpianto,<br />
                                    COALESCE ( <br />
                                        DATE_ADD(LAG(periodo_al, 1) OVER (PARTITION BY id_subimpianto ORDER BY periodo_al), INTERVAL 1 DAY), &#039;$periodo_dal&#039; ) AS from_date,<br />
                                        DATE_ADD(periodo_dal, INTERVAL -1 DAY) to_date, &#039;$periodo_dal&#039; AS start_date<br />
                                  FROM offertaitems<br />
                                  WHERE &#039;$periodo_dal&#039; &lt; periodo_al AND periodo_dal &lt; &#039;$periodo_al&#039;<br />
                                  GROUP BY id_subimpianto, periodo_dal, periodo_al<br />
                                ) t<br />
                                WHERE from_date &lt;= to_date<br />
                                UNION ALL<br />
                                SELECT<br />
                                    id_subimpianto AS id_subimpianto,<br />
                                    DATE_ADD(MAX(periodo_al), INTERVAL 1 DAY) AS from_date,<br />
                                    &#039;$periodo_al&#039; AS to_date,<br />
                                    &#039;$periodo_dal&#039; AS start_date<br />
                                FROM offertaitems<br />
                                GROUP BY id_subimpianto<br />
                                HAVING from_date &lt;= to_date<br />
                                ORDER BY 1,2;&quot;]]></description>
            <dc:creator>Ladis Kumar Antony Xavier</dc:creator>
            <category>Italian</category>
            <pubDate>Thu, 21 Oct 2021 10:36:27 +0000</pubDate>
        </item>
        <item>
            <guid>https://forums.mysql.com/read.php?129,698995,698995#msg-698995</guid>
            <title>Sottazione aggregata tra due tabelle (no replies)</title>
            <link>https://forums.mysql.com/read.php?129,698995,698995#msg-698995</link>
            <description><![CDATA[ Buogniorno ho due tabelle diverse devo sottrarre dei dati e mantenere l&#039;aggregazione, vi posto le due select distinte che funzionano:<br />
<br />
SELECT cont.policy_code AS NUMERO_POLIZZA, cont.output_type AS AZIONE ,<br />
COUNT(cont.output_type) AS totale <br />
FROM contab cont<br />
GROUP BY cont.policy_code<br />
order by cont.policy_code<br />
<br />
select  NPOL AS NUMERO_POLIZZA, AZIONE, count(AZIONE) AS TOTALE<br />
from altea_20210921_duplicati_esclusi<br />
GROUP BY NPOL<br />
<br />
Il problema è che devo unire le due select e fare in modo che i dati della seconda select vengano sottratti ai dati della prima mantenendo la struttura della prima nella select di ritorno.<br />
<br />
Grazie in anticipo a chi potrà aiutarmi.]]></description>
            <dc:creator>serenella angelilli</dc:creator>
            <category>Italian</category>
            <pubDate>Sun, 26 Sep 2021 07:00:52 +0000</pubDate>
        </item>
        <item>
            <guid>https://forums.mysql.com/read.php?129,698976,698976#msg-698976</guid>
            <title>Query modifica record che non funziona più (no replies)</title>
            <link>https://forums.mysql.com/read.php?129,698976,698976#msg-698976</link>
            <description><![CDATA[ Buongiorno a tutti,<br />
premetto di essere un vecchio utilizzatore di php e mysql ormai non più al passo con i tempi.<br />
Il codice che avevo creato per gestire la mia collezione di dischi non è più perfettamente funzionante con le ultime versioni php (ho l&#039;hosting su Altervista).<br />
Sono riuscito a modificare il codice sostituendo alcune funzioni deprecate per quanto riguarda aggiunta record, cancellazione record e ricerca ma ho problemi sulla modifica, nel senso che il record riesco a ricercarlo, entro in modifica sul record e sembra andare tutto bene ma la modifica non si salva.<br />
Questo è il codice relativo alla modifica dei record e ringrazio tutti quanti in anticipo:<br />
<br />
&lt;!DOCTYPE html&gt;<br />
&lt;!--<br />
To change this license header, choose License Headers in Project Properties.<br />
To change this template file, choose Tools | Templates<br />
and open the template in the editor.<br />
--&gt;<br />
&lt;html&gt;<br />
    &lt;head&gt;<br />
        &lt;meta charset=&quot;UTF-8&quot;&gt;<br />
        &lt;title&gt;Modifica Record&lt;/title&gt;<br />
    &lt;/head&gt;<br />
    &lt;body&gt;<br />
        &lt;?php<br />
        <br />
        $host = &#039;localhost&#039;;<br />
        $user = &#039;legalys&#039;;<br />
        $password = &#039;&#039;;<br />
        $db = &#039;my_legalys&#039;;<br />
        <br />
        $confirm=$_REQUEST[&#039;confirm&#039;];<br />
        $id=$_REQUEST[&#039;id&#039;];<br />
         <br />
        <br />
        $conne = mysqli_connect($host, $user, $password, $db) or die (&quot;impossibile connettersi al server $host&quot;);<br />
        mysqli_select_db($conne, $db) or die (&quot;impossibile connettersi al database $db&quot;);<br />
          <br />
        if (!$confirm)<br />
{                          <br />
        <br />
                $query = &quot;SELECT * FROM lp WHERE id=$id&quot;;         <br />
<br />
$dbresult = mysqli_query($conne, $query);<br />
$AffectedRows = mysqli_affected_rows($conne);<br />
if ($AffectedRows==0)<br />
{<br />
      print(&quot;&lt;h3&gt;Non esistono record con i criteri selezionati&lt;/h3&gt;&quot;);  <br />
       }<br />
else<br />
{<br />
mysqli_data_seek($dbresult,0);<br />
$row=mysqli_fetch_row($dbresult);<br />
<br />
   print(&quot;&lt;form method=\&quot;post\&quot;action=\&quot;{$_SERVER[&#039;PHP_SELF&#039;]}\&quot;&gt;&quot;);     <br />
print(&quot;&lt;table&gt;&quot;);<br />
   foreach ($row as $k =&gt; $v)<br />
{<br />
<br />
       $myfield = mysqli_fetch_field($dbresult,$k);       <br />
print(&quot;&lt;tr&gt;&lt;td&gt;$myfield-&gt;name&lt;/td&gt;&quot;);<br />
<br />
print(&quot;&lt;td&gt;&lt;input type=\&quot;text\&quot; value=\&quot;&quot; . $v . &quot;\&quot; name=\&quot;&quot; . $myfield-&gt;name . &quot;\&quot; size=\&quot;100\&quot; maxlength=\&quot;100\&quot; &gt;&lt;/td&gt;&lt;/tr&gt;&quot;);<br />
       <br />
}<br />
<br />
print(&quot;&lt;tr&gt;&lt;td colspan=\&quot;2\&quot;&gt;&lt;input type=\&quot;submit\&quot; value=\&quot;Conferma Modifiche\&quot;&gt;&lt;/td&gt;&lt;/tr&gt;  &quot;);<br />
        <br />
print(&quot;&lt;input type=\&quot;hidden\&quot; name=\&quot;confirm\&quot; value=\&quot;1\&quot;&gt;&quot;);      <br />
<br />
print(&quot;&lt;h3&gt;&lt;a href=\&quot;index1.html\&quot;&gt;Torna al Menù&lt;/a&gt;&lt;/h3&gt;&quot;);<br />
<br />
print(&quot;&lt;/table&gt;&quot;); <br />
print(&quot;&lt;/form&gt;&quot;);<br />
 <br />
mysqli_free_result($dbresult);<br />
mysqli_close($conne);<br />
}<br />
}<br />
else<br />
{<br />
$titolo=$_REQUEST[&#039;TITOLO&#039;];<br />
  $artista=$_REQUEST[&#039;ARTISTA&#039;];  <br />
    $sett=$_REQUEST[&#039;SETT&#039;];<br />
    $supp=$_REQUEST[&#039;SUPP&#039;];<br />
    $form=$_REQUEST[&#039;FORM&#039;];<br />
    $conf=$_REQUEST[&#039;CONF&#039;];<br />
        $ediz=$_REQUEST[&#039;EDIZ&#039;];<br />
        $naz=$_REQUEST[&#039;NAZ&#039;];<br />
        $st=$_REQUEST[&#039;ST&#039;];<br />
        $barcode=$_REQUEST[&#039;BARCODE&#039;];<br />
        $cod=$_REQUEST[&#039;COD&#039;];<br />
        $crisbc=$_REQUEST[&#039;CRISBC&#039;];<br />
        $anno_ed=$_REQUEST[&#039;ANNO_ED&#039;];<br />
            $anno=$_REQUEST[&#039;ANNO&#039;];<br />
        $etic=$_REQUEST[&#039;ETIC&#039;];<br />
        $brani=$_REQUEST[&#039;BRANI&#039;];<br />
            $note=$_REQUEST[&#039;NOTE&#039;];<br />
            $bustatesti=$_REQUEST[&#039;bustatesti&#039;];<br />
        $prezzo=$_REQUEST[&#039;PREZZO&#039;];<br />
            $cond=$_REQUEST[&#039;COND&#039;];<br />
            $dett=$_REQUEST[&#039;DETT&#039;];<br />
                $num=$_REQUEST[&#039;NUM&#039;];<br />
            $copie=$_REQUEST[&#039;COPIE&#039;];<br />
                        $link=$_REQUEST[&#039;LINK&#039;];<br />
<br />
    $query = &quot;update lp set titolo=\&quot;$titolo\&quot;,&quot; . &quot; artista=\&quot;$artista\&quot;,&quot;<br />
                      . &quot; sett=\&quot;$sett\&quot;,&quot; <br />
                    . &quot; supp=\&quot;$supp\&quot;,&quot;<br />
                         . &quot; form=\&quot;$form\&quot;,&quot;<br />
                     . &quot; conf=\&quot;$conf\&quot;,&quot;<br />
                      . &quot; ediz=\&quot;$ediz\&quot;,&quot;<br />
                         . &quot; naz=\&quot;$naz\&quot;,&quot;<br />
                            . &quot; st=\&quot;$st\&quot;,&quot;<br />
                            . &quot; barcode=\&quot;$barcode\&quot;,&quot;<br />
                                 . &quot; cod=\&quot;$cod\&quot;,&quot;<br />
                                 . &quot; crisbc=\&quot;$crisbc\&quot;,&quot;<br />
                                . &quot; anno_ed=\&quot;$anno_ed\&quot;,&quot;<br />
                               . &quot; anno=\&quot;$anno\&quot;,&quot;<br />
                                  . &quot; etic=\&quot;$etic\&quot;,&quot;<br />
         . &quot; brani=\&quot;$brani\&quot;,&quot;<br />
         . &quot; note=\&quot;$note\&quot;,&quot;<br />
         . &quot; bustatesti=\&quot;$bustatesti\&quot;,&quot;<br />
         . &quot; prezzo=\&quot;$prezzo\&quot;,&quot;<br />
         . &quot; cond=\&quot;$cond\&quot;,&quot;<br />
         . &quot; dett=\&quot;$dett\&quot;,&quot;<br />
         . &quot; num=\&quot;$num\&quot;,&quot;<br />
              . &quot; copie=\&quot;$copie\&quot;,&quot;<br />
                  . &quot; link=\&quot;$link\&quot;&quot;<br />
                  . &quot;where id=$id&quot;;<br />
           <br />
$dbresult = mysqli_query($conne, $query);<br />
$AffectedRows = mysqli_affected_rows($conne);<br />
if ($AffectedRows!=0)<br />
{<br />
print(&quot;&lt;h3&gt;Il Record è Stato Aggiornato Con Successo&lt;/h3&gt;&quot;);<br />
print(&quot;&lt;h3&gt;&lt;a href=\&quot;index1.html\&quot;&gt;Torna Al Menu&lt;/a&gt;&lt;/h3&gt;&quot;);<br />
print(&quot;&lt;h3&gt;&lt;a href=\&quot;search_mob.html\&quot;&gt;Nuova Ricerca&lt;/a&gt;&lt;/h3&gt;&quot;);<br />
print(&quot;&lt;h3&gt;&lt;a href=\&quot;insert.html\&quot;&gt;Inserimento Record&lt;/a&gt;&lt;/h3&gt;&quot;);<br />
}<br />
mysqli_close($conne);<br />
}<br />
        <br />
        ?&gt;<br />
               <br />
    &lt;/body&gt;<br />
&lt;/html&gt;]]></description>
            <dc:creator>Cristiano Orlando</dc:creator>
            <category>Italian</category>
            <pubDate>Thu, 23 Sep 2021 17:19:26 +0000</pubDate>
        </item>
        <item>
            <guid>https://forums.mysql.com/read.php?129,698851,698851#msg-698851</guid>
            <title>LEGGERE (READ) E AGGIORNARE (UPDATE) (no replies)</title>
            <link>https://forums.mysql.com/read.php?129,698851,698851#msg-698851</link>
            <description><![CDATA[ Ciao Ragazzi , chiedo dopo aver aperta la connessione sto leggendo riga per riga posso contemporaneamente aggiornarla.<br />
<br />
Mi spiego meglio ho un campo (avviso) nella mia riga di record che devo modificarlo  , è il confronto di due  date quella inserita e il NOW la risultante mi dice che sono due giorni che non vedo un ping ? e me lo scrive cambiandolo.<br />
<br />
tutto questo mentre leggo la riga e modificarla contemporaneamente.<br />
Non so se sia possibile chiedo agli esperti<br />
<br />
Grazie <br />
Paolo]]></description>
            <dc:creator>PAOLO SPAGNOLO</dc:creator>
            <category>Italian</category>
            <pubDate>Wed, 15 Sep 2021 14:10:45 +0000</pubDate>
        </item>
    </channel>
</rss>
