|
Posted by strawberry on 10/02/06 22:54
mantrid wrote:
> I have records from a database that are extracted with php and displayed in
> a table.
> Data in some of the fields is replicated
>
> eg
> something1,item1,somethingelse1
> something1,item1,somethingelse2
> something1,item2,somethingelse3
> something1,item2,somethingelse4
> something2,item1,somethingelse5
> something2,item1,somethingelse6
> something2,item2,somethingelse7
> something2,item2,somethingelse8
>
> i wish to tidy this up and make it more readable by putting repeated fields
> as a header row or something along those lines
> eg
>
> something1
> item1
> somethingelse1
> somethingelse2
> item2
> somethingelse3
> somethingelse4
>
> something2
> item1
> somethingelse5
> somethingelse6
> item2
> somethingelse7
> somethingelse8
>
> I think I can do it using about 3 sql statements two of which use grouping,
> but I would like to know if there is a more elegant solution using the one
> sql and somehow doing the grouping in the php.
>
> Anyone done anything similar, or seen an example out there?
>
> Thanks Ian
why not do the grouping in sql. It might just be simpler abd quicker
Navigation:
[Reply to this message]
|