Information générale
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Try this:
select dist name, box,media from (table) into curs tmpcurs1 nofilt
select name, cnt(*) ,media from tmpcurs1 group by 1,3
>I need help getting information out of a table that is not normalized. I think what I need is a nested select statement but it’s not coming together.
>
>What I have is a table with four fields: name, box, media, title.
>
>Name..Box..Media..Title
>Jane...1....CD.....A
>Jane...1....CD.....B
>Jane...2....CD.....C
>Jane...3....TAPE...A
>Joe....1....CD.....A
>Joe....2....CD.....B
>Joe....3....TAPE...A
>Joe....3....TAPE...B
>Joe....4....TAPE...C
>Joe....4....DISK...A
>
>What I need to know is how many boxes of each media per individual.
>A bonus, which I don’t think is possible, would to some how identify those boxes which have split content. For example: Joe has one box (box 4) that contains both tape and disk.
>
>Jane
>2....CD
>1....Tape
>
>Joe
>2...CD
>2...TAPE
>1...Disk
>
>Any help would be appreciated.
>TIA
>Peter
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement