• Ricetta (per query ma anche per mangiare)

    From Leonardo Boselli@21:1/5 to All on Thu Jun 15 13:50:01 2023
    This message is in MIME format. The first part should be readable text,
    while the remaining parts are likely unreadable without MIME-aware tools.

    Ho un database con colonne ID[integer], Ingredienti[text],
    commensali[float], data[datetime].

    Il campo ingredientoi contiene una lista (tra 1 e 20 valori, separati da spazio) degli ingredienti presenti per oltre il 5% del menu.

    Domadona: c'è un modo di estrarre una tabella che mi dia "ingrediente" e "frequenza" ossia ogni ingrediente in quante cene è statao presente ? (ovviamante un group by ingredienti non funziona in quanto un rtecord
    potrebbe avere «pasta pomodoro fungo maiale mela» un altre «riso fungo prezzemolo maiale» e quindi in uscita dovrei avere maiale:2 fungo:2
    pasta:1 pomodoro:1 ...)
    C'è un modo diretto restando in una query sql ?
    --
    Leonardo Boselli
    Firenze, Toscana, Europa

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Federico Di Gregorio@21:1/5 to Leonardo Boselli on Thu Jun 15 14:40:01 2023
    Se usi PostgreSQL si, la funzione "string_to_array" crea un array a
    partire da una stringa e "unnest" crea una riga per ogni elemento
    dell'array, sul quale fare ground by. Per esempio:

    WITH ingredienti AS (
    SELECT unnest(string_to_array(ingredienti, ' ')) AS ingrediente
    FROM menu
    )

    SELECT I.ingrediente, count(*)
    FROM ingredienti I
    GROUP BY 1
    ;

    Con altri database più sfigati, non saprei.

    federico

    On 15/06/23 13:48, Leonardo Boselli wrote:
    Ho un database con colonne ID[integer], Ingredienti[text],
    commensali[float], data[datetime].

    Il campo ingredientoi contiene una lista (tra 1 e 20 valori, separati da spazio) degli ingredienti presenti per oltre il 5% del menu.

    Domadona: c'è un modo di estrarre una tabella che mi dia "ingrediente" e "frequenza" ossia ogni ingrediente in quante cene è statao presente ? (ovviamante un group by ingredienti non funziona in quanto un rtecord potrebbe avere «pasta pomodoro fungo maiale mela» un altre «riso fungo prezzemolo maiale» e quindi in uscita dovrei avere maiale:2 fungo:2
    pasta:1 pomodoro:1 ...)
    C'è un modo diretto restando in una query sql ?
    --
    Leonardo Boselli
    Firenze, Toscana, Europa

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lorenzo Breda@21:1/5 to All on Thu Jun 15 14:20:01 2023
    Ni. La risposta giusta è che i db non si fanno a quel modo. La risposta
    lunga è che puoi trasformare il campo in json (',' con '","' su json_array(Ingredienti)) e poi con json_table() ottenere una struttura
    simile a come sarebbe un join con una tabella degli ingredienti (che è come andrebbe fatto). Su quella ci vai di group by.


    Il giorno gio 15 giu 2023 alle ore 13:48 Leonardo Boselli < leo-stretch@trail.it> ha scritto:

    Ho un database con colonne ID[integer], Ingredienti[text],
    commensali[float], data[datetime].

    Il campo ingredientoi contiene una lista (tra 1 e 20 valori, separati da spazio) degli ingredienti presenti per oltre il 5% del menu.

    Domadona: c'è un modo di estrarre una tabella che mi dia "ingrediente" e "frequenza" ossia ogni ingrediente in quante cene è statao presente ? (ovviamante un group by ingredienti non funziona in quanto un rtecord potrebbe avere «pasta pomodoro fungo maiale mela» un altre «riso fungo prezzemolo maiale» e quindi in uscita dovrei avere maiale:2 fungo:2
    pasta:1 pomodoro:1 ...)
    C'è un modo diretto restando in una query sql ?
    --
    Leonardo Boselli
    Firenze, Toscana, Europa



    --
    Lorenzo Breda

    <div dir="ltr"><div>Ni. La risposta giusta è che i db non si fanno a quel modo. La risposta lunga è che puoi trasformare il campo in json (&#39;,&#39; con &#39;&quot;,&quot;&#39; su json_array(Ingredienti)) e poi con json_table() ottenere una struttura
    simile a come sarebbe un join con una tabella degli ingredienti (che è come andrebbe fatto). Su quella ci vai di group by. </div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il giorno gio 15 giu 2023 alle ore 13:48 Leonardo
    Boselli &lt;<a href="mailto:leo-stretch@trail.it">leo-stretch@trail.it</a>&gt; ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Ho un database con colonne ID[
    integer], Ingredienti[text], <br>
    commensali[float], data[datetime].<br>

    Il campo ingredientoi contiene una lista (tra 1 e 20 valori, separati da <br> spazio) degli ingredienti presenti per oltre il 5% del menu.<br>

    Domad
  • From Leonardo Boselli@21:1/5 to Diego Zuccato on Fri Jun 16 08:50:01 2023
    This message is in MIME format. The first part should be readable text,
    while the remaining parts are likely unreadable without MIME-aware tools.

    On Thu, 15 Jun 2023, Diego Zuccato wrote:
    Uhm... Il DB è denormalizzato, e questo rende complicato fare queste query.

    il DB non lo puoi toccare, o meglio, quel campo ingredienti deve restare
    come è. Tuttavia si può fare una semplificazione: siccome gli ingredienti sono messi in ordine di importanza, e il rischio di avere duplicati è
    reale abbiamo una alternativa:
    consideriamo nella query solo il primo ingrediente, ossia lo tronchiamo virtualmente al primo spazio.

    Assumendo che un ingrediente figuri una sola volta per cena.

    Diego


    --
    Leonardo Boselli
    Firenze, Toscana, Europa

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Alessio Baldino@21:1/5 to All on Fri Jun 16 18:30:02 2023
    Questa funziona sicuramente su MS SQL Server.

    Fa il conteggio degli ingredienti fino a 6, ma espandendola a 20 (io non
    me la sono sentita :)) li prenderebbe tutti.

    select D.Ingrediente, COUNT(D.ID) as Conteggio
    from (
        select C.ID, cast(C.Ingrediente1 as varchar) as Ingrediente
        from (
            select B.ID,
            case when not B.IDX1 is null then SUBSTRING(B.Ingredienti, 1, B.IDX1) else B.Ingredienti end AS Ingrediente1,
            case when not B.IDX1 is null then case when not B.IDX2 is null then SUBSTRING(B.Ingredienti, B.IDX1, B.IDX2 - B.IDX1) else SUBSTRING(B.Ingredienti, B.IDX1, 1000000) end else null end AS
    Ingrediente2,
            case when not B.IDX2 is null then case when not B.IDX3 is null then SUBSTRING(B.Ingredienti, B.IDX2, B.IDX3 - B.IDX2) else SUBSTRING(B.Ingredienti, B.IDX2, 1000000) end else null end AS
    Ingrediente3,
            case when not B.IDX3 is null then case when not B.IDX4 is null then SUBSTRING(B.Ingredienti, B.IDX3, B.IDX4 - B.IDX3) else SUBSTRING(B.Ingredienti, B.IDX3, 1000000) end else null end AS
    Ingrediente4,
            case when not B.IDX4 is null then case when not B.IDX5 is null then SUBSTRING(B.Ingredienti, B.IDX4, B.IDX5 - B.IDX4) else SUBSTRING(B.Ingredienti, B.IDX4, 1000000) end else null end AS
    Ingrediente5,
            case when not B.IDX5 is null then case when not B.IDX6 is null then SUBSTRING(B.Ingredienti, B.IDX5, B.IDX6 - B.IDX5) else SUBSTRING(B.Ingredienti, B.IDX5, 1000000) end else null end AS Ingrediente6
            from (
                select *, case when CHARINDEX(' ', Ingredienti, IDX5 + 1) >
    0 then CHARINDEX(' ', Ingredienti, IDX5 + 1) else null end as IDX6
                from (
                    select *, case when CHARINDEX(' ', Ingredienti, IDX4 +
    1) > 0 then CHARINDEX(' ', Ingredienti, IDX4 + 1) else null end as IDX5
                    from (
                        select *, case when CHARINDEX(' ', Ingredienti,
    IDX3 + 1) > 0 then CHARINDEX(' ', Ingredienti, IDX3 + 1) else null end
    as IDX4
                        from (
                            select *, case when CHARINDEX(' ', Ingredienti,
    IDX2 + 1) > 0 then CHARINDEX(' ', Ingredienti, IDX2 + 1) else null end
    as IDX3
                            from (
                                select *, case when CHARINDEX(' ',
    Ingredienti, IDX1 + 1) > 0 then CHARINDEX(' ', Ingredienti, IDX1 + 1)
    else null end as IDX2
                                from (
                                    select ID, Ingredienti, case when
    CHARINDEX(' ', Ingredienti, 1) > 0 then CHARINDEX(' ', Ingredienti, 1)
    else null end as IDX1 from @tab
                                    ) as A
                                ) as A
                            ) as A
                        ) as A
                    ) as A
                ) as B
            ) as C
        union
        select C.ID, cast(C.Ingrediente2 as varchar) as Ingrediente
        from (
            select B.ID,
            case when not B.IDX1 is null then SUBSTRING(B.Ingredienti, 1, B.IDX1) else B.Ingredienti end AS Ingrediente1,
            case when not B.IDX1 is null then case when not B.IDX2 is null then SUBSTRING(B.Ingredienti, B.IDX1, B.IDX2 - B.IDX1) else SUBSTRING(B.Ingredienti, B.IDX1, 1000000) end else null end AS
    Ingrediente2,
            case when not B.IDX2 is null then case when not B.IDX3 is null then SUBSTRING(B.Ingredienti, B.IDX2, B.IDX3 - B.IDX2) else SUBSTRING(B.Ingredienti, B.IDX2, 1000000) end else null end AS
    Ingrediente3,
            case when not B.IDX3 is null then case when not B.IDX4 is null then SUBSTRING(B.Ingredienti, B.IDX3, B.IDX4 - B.IDX3) else SUBSTRING(B.Ingredienti, B.IDX3, 1000000) end else null end AS
    Ingrediente4,
            case when not B.IDX4 is null then case when not B.IDX5 is null then SUBSTRING(B.Ingredienti, B.IDX4, B.IDX5 - B.IDX4) else SUBSTRING(B.Ingredienti, B.IDX4, 1000000) end else null end AS
    Ingrediente5,
            case when not B.IDX5 is null then case when not B.IDX6 is null then SUBSTRING(B.Ingredienti, B.IDX5, B.IDX6 - B.IDX5) else SUBSTRING(B.Ingredienti, B.IDX5, 1000000) end else null end AS Ingrediente6
            from (
                select *, case when CHARINDEX(' ', Ingredienti, IDX5 + 1) >
    0 then CHARINDEX(' ', Ingredienti, IDX5 + 1) else null end as IDX6
                from (
                    select *, case when CHARINDEX(' ', Ingredienti, IDX4 +
    1) > 0 then CHARINDEX(' ', Ingredienti, IDX4 + 1) else null end as IDX5
                    from (
                        select *, case when CHARINDEX(' ', Ingredienti,
    IDX3 + 1) > 0 then CHARINDEX(' ', Ingredienti, IDX3 + 1) else null end
    as IDX4
                        from (
                            select *, case when CHARINDEX(' ', Ingredienti,
    IDX2 + 1) > 0 then CHARINDEX(' ', Ingredienti, IDX2 + 1) else null end
    as IDX3
                            from (
                                select *, case when CHARINDEX(' ',
    Ingredienti, IDX1 + 1) > 0 then CHARINDEX(' ', Ingredienti, IDX1 + 1)
    else null end as IDX2
                                from (
                                    select ID, Ingredienti, case when
    CHARINDEX(' ', Ingredienti, 1) > 0 then CHARINDEX(' ', Ingredienti, 1)
    else null end as IDX1 from @tab
                                    ) as A
                                ) as A
                            ) as A
                        ) as A
                    ) as A
                ) as B
            ) as C
        union
        select C.ID, cast(C.Ingrediente3 as varchar) as Ingrediente
        from (
            select B.ID,
            case when not B.IDX1 is null then SUBSTRING(B.Ingredienti, 1, B.IDX1) else B.Ingredienti end AS Ingrediente1,
            case when not B.IDX1 is null then case when not B.IDX2 is null then SUBSTRING(B.Ingredienti, B.IDX1, B.IDX2 - B.IDX1) else SUBSTRING(B.Ingredienti, B.IDX1, 1000000) end else null end AS
    Ingrediente2,
            case when not B.IDX2 is null then case when not B.IDX3 is null then SUBSTRING(B.Ingredienti, B.IDX2, B.IDX3 - B.IDX2) else SUBSTRING(B.Ingredienti, B.IDX2, 1000000) end else null end AS
    Ingrediente3,
            case when not B.IDX3 is null then case when not B.IDX4 is null then SUBSTRING(B.Ingredienti, B.IDX3, B.IDX4 - B.IDX3) else SUBSTRING(B.Ingredienti, B.IDX3, 1000000) end else null end AS
    Ingrediente4,
            case when not B.IDX4 is null then case when not B.IDX5 is null then SUBSTRING(B.Ingredienti, B.IDX4, B.IDX5 - B.IDX4) else SUBSTRING(B.Ingredienti, B.IDX4, 1000000) end else null end AS
    Ingrediente5,
            case when not B.IDX5 is null then case when not B.IDX6 is null then SUBSTRING(B.Ingredienti, B.IDX5, B.IDX6 - B.IDX5) else SUBSTRING(B.Ingredienti, B.IDX5, 1000000) end else null end AS Ingrediente6
            from (
                select *, case when CHARINDEX(' ', Ingredienti, IDX5 + 1) >
    0 then CHARINDEX(' ', Ingredienti, IDX5 + 1) else null end as IDX6
                from (
                    select *, case when CHARINDEX(' ', Ingredienti, IDX4 +
    1) > 0 then CHARINDEX(' ', Ingredienti, IDX4 + 1) else null end as IDX5
                    from (
                        select *, case when CHARINDEX(' ', Ingredienti,
    IDX3 + 1) > 0 then CHARINDEX(' ', Ingredienti, IDX3 + 1) else null end
    as IDX4
                        from (
                            select *, case when CHARINDEX(' ', Ingredienti,
    IDX2 + 1) > 0 then CHARINDEX(' ', Ingredienti, IDX2 + 1) else null end
    as IDX3
                            from (
                                select *, case when CHARINDEX(' ',
    Ingredienti, IDX1 + 1) > 0 then CHARINDEX(' ', Ingredienti, IDX1 + 1)
    else null end as IDX2
                                from (
                                    select ID, Ingredienti, case when
    CHARINDEX(' ', Ingredienti, 1) > 0 then CHARINDEX(' ', Ingredienti, 1)
    else null end as IDX1 from @tab
                                    ) as A
                                ) as A
                            ) as A
                        ) as A
                    ) as A
                ) as B
            ) as C
        union
        select C.ID, cast(C.Ingrediente4 as varchar) as Ingrediente
        from (
            select B.ID,
            case when not B.IDX1 is null then SUBSTRING(B.Ingredienti, 1, B.IDX1) else B.Ingredienti end AS Ingrediente1,
            case when not B.IDX1 is null then case when not B.IDX2 is null then SUBSTRING(B.Ingredienti, B.IDX1, B.IDX2 - B.IDX1) else SUBSTRING(B.Ingredienti, B.IDX1, 1000000) end else null end AS
    Ingrediente2,
            case when not B.IDX2 is null then case when not B.IDX3 is null then SUBSTRING(B.Ingredienti, B.IDX2, B.IDX3 - B.IDX2) else SUBSTRING(B.Ingredienti, B.IDX2, 1000000) end else null end AS
    Ingrediente3,
            case when not B.IDX3 is null then case when not B.IDX4 is null then SUBSTRING(B.Ingredienti, B.IDX3, B.IDX4 - B.IDX3) else SUBSTRING(B.Ingredienti, B.IDX3, 1000000) end else null end AS
    Ingrediente4,
            case when not B.IDX4 is null then case when not B.IDX5 is null then SUBSTRING(B.Ingredienti, B.IDX4, B.IDX5 - B.IDX4) else SUBSTRING(B.Ingredienti, B.IDX4, 1000000) end else null end AS
    Ingrediente5,
            case when not B.IDX5 is null then case when not B.IDX6 is null then SUBSTRING(B.Ingredienti, B.IDX5, B.IDX6 - B.IDX5) else SUBSTRING(B.Ingredienti, B.IDX5, 1000000) end else null end AS Ingrediente6
            from (
                select *, case when CHARINDEX(' ', Ingredienti, IDX5 + 1) >
    0 then CHARINDEX(' ', Ingredienti, IDX5 + 1) else null end as IDX6
                from (
                    select *, case when CHARINDEX(' ', Ingredienti, IDX4 +
    1) > 0 then CHARINDEX(' ', Ingredienti, IDX4 + 1) else null end as IDX5
                    from (
                        select *, case when CHARINDEX(' ', Ingredienti,
    IDX3 + 1) > 0 then CHARINDEX(' ', Ingredienti, IDX3 + 1) else null end
    as IDX4
                        from (
                            select *, case when CHARINDEX(' ', Ingredienti,
    IDX2 + 1) > 0 then CHARINDEX(' ', Ingredienti, IDX2 + 1) else null end
    as IDX3
                            from (
                                select *, case when CHARINDEX(' ',
    Ingredienti, IDX1 + 1) > 0 then CHARINDEX(' ', Ingredienti, IDX1 + 1)
    else null end as IDX2
                                from (
                                    select ID, Ingredienti, case when
    CHARINDEX(' ', Ingredienti, 1) > 0 then CHARINDEX(' ', Ingredienti, 1)
    else null end as IDX1 from @tab
                                    ) as A
                                ) as A
                            ) as A
                        ) as A
                    ) as A
                ) as B
            ) as C
        union
        select C.ID, cast(C.Ingrediente5 as varchar) as Ingrediente
        from (
            select B.ID,
            case when not B.IDX1 is null then SUBSTRING(B.Ingredienti, 1, B.IDX1) else B.Ingredienti end AS Ingrediente1,
            case when not B.IDX1 is null then case when not B.IDX2 is null then SUBSTRING(B.Ingredienti, B.IDX1, B.IDX2 - B.IDX1) else SUBSTRING(B.Ingredienti, B.IDX1, 1000000) end else null end AS
    Ingrediente2,
            case when not B.IDX2 is null then case when not B.IDX3 is null then SUBSTRING(B.Ingredienti, B.IDX2, B.IDX3 - B.IDX2) else SUBSTRING(B.Ingredienti, B.IDX2, 1000000) end else null end AS
    Ingrediente3,
            case when not B.IDX3 is null then case when not B.IDX4 is null then SUBSTRING(B.Ingredienti, B.IDX3, B.IDX4 - B.IDX3) else SUBSTRING(B.Ingredienti, B.IDX3, 1000000) end else null end AS
    Ingrediente4,
            case when not B.IDX4 is null then case when not B.IDX5 is null then SUBSTRING(B.Ingredienti, B.IDX4, B.IDX5 - B.IDX4) else SUBSTRING(B.Ingredienti, B.IDX4, 1000000) end else null end AS
    Ingrediente5,
            case when not B.IDX5 is null then case when not B.IDX6 is null then SUBSTRING(B.Ingredienti, B.IDX5, B.IDX6 - B.IDX5) else SUBSTRING(B.Ingredienti, B.IDX5, 1000000) end else null end AS Ingrediente6
            from (
                select *, case when CHARINDEX(' ', Ingredienti, IDX5 + 1) >
    0 then CHARINDEX(' ', Ingredienti, IDX5 + 1) else null end as IDX6
                from (
                    select *, case when CHARINDEX(' ', Ingredienti, IDX4 +
    1) > 0 then CHARINDEX(' ', Ingredienti, IDX4 + 1) else null end as IDX5
                    from (
                        select *, case when CHARINDEX(' ', Ingredienti,
    IDX3 + 1) > 0 then CHARINDEX(' ', Ingredienti, IDX3 + 1) else null end
    as IDX4
                        from (
                            select *, case when CHARINDEX(' ', Ingredienti,
    IDX2 + 1) > 0 then CHARINDEX(' ', Ingredienti, IDX2 + 1) else null end
    as IDX3
                            from (
                                select *, case when CHARINDEX(' ',
    Ingredienti, IDX1 + 1) > 0 then CHARINDEX(' ', Ingredienti, IDX1 + 1)
    else null end as IDX2
                                from (
                                    select ID, Ingredienti, case when
    CHARINDEX(' ', Ingredienti, 1) > 0 then CHARINDEX(' ', Ingredienti, 1)
    else null end as IDX1 from @tab
                                    ) as A
                                ) as A
                            ) as A
                        ) as A
                    ) as A
                ) as B
            ) as C
        union
        select C.ID, cast(C.Ingrediente6 as varchar) as Ingrediente
        from (
            select B.ID,
            case when not B.IDX1 is null then SUBSTRING(B.Ingredienti, 1, B.IDX1) else B.Ingredienti end AS Ingrediente1,
            case when not B.IDX1 is null then case when not B.IDX2 is null then SUBSTRING(B.Ingredienti, B.IDX1, B.IDX2 - B.IDX1) else SUBSTRING(B.Ingredienti, B.IDX1, 1000000) end else null end AS
    Ingrediente2,
            case when not B.IDX2 is null then case when not B.IDX3 is null then SUBSTRING(B.Ingredienti, B.IDX2, B.IDX3 - B.IDX2) else SUBSTRING(B.Ingredienti, B.IDX2, 1000000) end else null end AS
    Ingrediente3,
            case when not B.IDX3 is null then case when not B.IDX4 is null then SUBSTRING(B.Ingredienti, B.IDX3, B.IDX4 - B.IDX3) else SUBSTRING(B.Ingredienti, B.IDX3, 1000000) end else null end AS
    Ingrediente4,
            case when not B.IDX4 is null then case when not B.IDX5 is null then SUBSTRING(B.Ingredienti, B.IDX4, B.IDX5 - B.IDX4) else SUBSTRING(B.Ingredienti, B.IDX4, 1000000) end else null end AS
    Ingrediente5,
            case when not B.IDX5 is null then case when not B.IDX6 is null then SUBSTRING(B.Ingredienti, B.IDX5, B.IDX6 - B.IDX5) else SUBSTRING(B.Ingredienti, B.IDX5, 1000000) end else null end AS Ingrediente6
            from (
                select *, case when CHARINDEX(' ', Ingredienti, IDX5 + 1) >
    0 then CHARINDEX(' ', Ingredienti, IDX5 + 1) else null end as IDX6
                from (
                    select *, case when CHARINDEX(' ', Ingredienti, IDX4 +
    1) > 0 then CHARINDEX(' ', Ingredienti, IDX4 + 1) else null end as IDX5
                    from (
                        select *, case when CHARINDEX(' ', Ingredienti,
    IDX3 + 1) > 0 then CHARINDEX(' ', Ingredienti, IDX3 + 1) else null end
    as IDX4
                        from (
                            select *, case when CHARINDEX(' ', Ingredienti,
    IDX2 + 1) > 0 then CHARINDEX(' ', Ingredienti, IDX2 + 1) else null end
    as IDX3
                            from (
                                select *, case when CHARINDEX(' ',
    Ingredienti, IDX1 + 1) > 0 then CHARINDEX(' ', Ingredienti, IDX1 + 1)
    else null end as IDX2
                                from (
                                    select ID, Ingredienti, case when
    CHARINDEX(' ', Ingredienti, 1) > 0 then CHARINDEX(' ', Ingredienti, 1)
    else null end as IDX1 from @tab
                                    ) as A
                                ) as A
                            ) as A
                        ) as A
                    ) as A
                ) as B
            ) as C
        ) as D
    where D.Ingrediente is not null
    group by D.Ingrediente
    order by D.Ingrediente

    Il 15/06/2023 13:48, Leonardo Boselli ha scritto:
    Ho un database con colonne ID[integer], Ingredienti[text],
    commensali[float], data[datetime].

    Il campo ingredientoi contiene una lista (tra 1 e 20 valori, separati
    da spazio) degli ingredienti presenti per oltre il 5% del menu.

    Domadona: c'è un modo di estrarre una tabella che mi dia "ingrediente"
    e "frequenza" ossia ogni ingrediente in quante cene è statao presente ? (ovviamante un group by ingredienti non funziona in quanto un rtecord potrebbe avere «pasta pomodoro fungo maiale mela» un altre «riso fungo prezzemolo maiale» e quindi in uscita dovrei avere maiale:2 fungo:2
    pasta:1 pomodoro:1 ...)
    C'è un modo diretto restando in una query sql ?
    --
    Leonardo Boselli
    Firenze, Toscana, Europa

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Alessio Baldino@21:1/5 to All on Fri Jun 16 21:30:01 2023
    La variabile @tab va sostituita con il nome delle tua tabella

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)