Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > it.comp.www.php > #22934

Re: Memorizzare ricette, materie prime e magazzino di un ristorante

From ^Bart <gabriele1NOSPAM@hotmail.com>
Newsgroups it.comp.www.php
Subject Re: Memorizzare ricette, materie prime e magazzino di un ristorante
Date 2021-07-18 09:38 +0200
Organization Aioe.org NNTP Server
Message-ID <sd0lpi$rir$1@gioia.aioe.org> (permalink)
References <scbo3k$ab8$1@gioia.aioe.org> <schi4b$1hln$1@gioia.aioe.org> <scp7cl$16rk$1@gioia.aioe.org> <scre5i$1r0g$1@gioia.aioe.org>

Show all headers | View raw


> esempio:
> 
> Categoria
> --------
> id_categoria = 1
> descrizione = Pasta
> categoria_padre = null
> ----
> id_categoria = 2
> descrizione = pasta sfoglia
> categoria_padre = 1

Rilancio... :) ma se ad esempio dovessimo memorizzare i tipi di carne, 
le tipologie di latte, etc. a quel punto avremmo ridondanza di dati!

Come da me ipotizzato inizialmente volevo creare una tabella principale 
chiamata ITEMS ed una SUBITEMS in modo che nella ITEMS potessi mettere 
ad esempio carne, latte, pasta, etc. e nella SUBITEMS le varie tipologie.

Se mettessi tutto in un'unica tabella mi vedrei la parola latte o carne 
ripetuta più volte...

> la query con mysql 8
> 
> with recursive lista_cat (id_categoria, descrizione, categoria_padre) as (
>    select     id_categoria,
>               descrizione,
>               categoria_padre
>    from       categoria
>    union all
>    select     p.id_categoria,
>               p.descrizione,
>               p.categoria_padre
>    from       categoria p
>    inner join lista_cat
>            on p.categoria_padre = lista_cat.id_categoria
> )
> select * from lista_cat;

Mi segno comunque la query che può tornarmi utile! :)

Saluti.
^Bart

Back to it.comp.www.php | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Memorizzare ricette, materie prime e magazzino di un ristorante ^Bart <gabriele1NOSPAM@hotmail.com> - 2021-07-10 11:09 +0200
  Re: Memorizzare ricette, materie prime e magazzino di un ristorante ^Bart <gabriele1NOSPAM@hotmail.com> - 2021-07-10 12:40 +0200
    Re: Memorizzare ricette, materie prime e magazzino di un ristorante Ammammata <ammammata@tiscalinet.it> - 2021-07-12 07:05 +0000
      Re: Memorizzare ricette, materie prime e magazzino di un ristorante ^Bart <gabriele1NOSPAM@hotmail.com> - 2021-07-15 13:00 +0200
        Re: Memorizzare ricette, materie prime e magazzino di un ristorante Ammammata <ammammata@tiscalinet.it> - 2021-07-15 13:16 +0000
          Re: Memorizzare ricette, materie prime e magazzino di un ristorante ^Bart <gabriele1NOSPAM@hotmail.com> - 2021-07-18 09:40 +0200
  Re: Memorizzare ricette, materie prime e magazzino di un ristorante bramante <bramante@yopmail.com> - 2021-07-12 16:03 +0200
    Re: Memorizzare ricette, materie prime e magazzino di un ristorante ^Bart <gabriele1NOSPAM@hotmail.com> - 2021-07-15 13:49 +0200
      Re: Memorizzare ricette, materie prime e magazzino di un ristorante bramante <bramante@yopmail.com> - 2021-07-16 09:57 +0200
        Re: Memorizzare ricette, materie prime e magazzino di un ristorante ^Bart <gabriele1NOSPAM@hotmail.com> - 2021-07-18 09:38 +0200

csiph-web