-1

I have 2 tables

  • tb1 - scene
  • tb2 - characters

What I am rying to do is

(tb1)scene             (tb2)charaters

(tb1)1                  (tb2)jhon
                             mary
                             charles
                             etc...

But I am getting this

(tb1)1            (tb2) jhon,
(tb1)1            (tb2) mary,
(tb1)1            (tb2) charles,
(tb1)1            (tb2)etc...,

How can I "hide" the dup results on table 1?

Armando
  • 3
  • 3
  • 1
    Which DBMS are you using? –  Jul 26 '16 at 10:02
  • 3
    Those are not duplicates. That's exactly how sql join works. Maybe you mean how can you group all those records and have all the strings concatenated together – Gilad Green Jul 26 '16 at 10:02
  • Please edit your question to make this understandable. Add the proper DBMS tag, add your SQL instructions and format your code. – Thomas G Jul 26 '16 at 10:04
  • 1
    @ThomasG, please, no parentheses for `DISTINCT`! It's not a function!!! – jarlh Jul 26 '16 at 10:05
  • lol... guys calm down. I did not even terminate my comment edition and finally removed that part even before you commented on that detail mistake... – Thomas G Jul 26 '16 at 10:06
  • What you are trying to do is the presentation issue. You need to do it in the front end application when you show the data – Madhivanan Jul 26 '16 at 10:07
  • @Armando - Please specify which DBMS so we can help you solve the issue – Gilad Green Jul 26 '16 at 10:10
  • Possible duplicate of [How to use GROUP BY to concatenate strings in MySQL?](http://stackoverflow.com/questions/149772/how-to-use-group-by-to-concatenate-strings-in-mysql) – Gilad Green Jul 26 '16 at 11:14
  • It looks like this is the answer im lookin for. The concat.. Ill try this, and be back later to comment. – Armando Jul 26 '16 at 11:35
  • well, not that... Im using the RADbuilder with a .mdb database the problem is that the reports in RADbuilder dont have the hide dupes. Im crackin my head with this... and yes... Its a presentation issue... thanks guys. Any sugestions? – Armando Jul 26 '16 at 11:39
  • im currently using this query SELECT personagens.personagem,producao.EP,producao.CENA FROM personagens INNER JOIN producao ON personagens.ID=producao.ID – Armando Jul 26 '16 at 11:42
  • well. None off the trying worked. I just opted to let the report a little more extensive, using a header and 2 subdetails... Works just fine. Maybe ill come around with another solution later. Thanks to you all guys. – Armando Jul 26 '16 at 22:10

1 Answers1

0
select  case ROW_NUMBER() over (partition by scene order by scene) 
when 1 then scene else '' end scene_norm, 
characters 
from tb2 join tb1 on [join clause]
order by scene 

Tested on other tables, I hope I didn't mix anything.