postgresql - SQL to find duplicate foreign keys in a group -


Originally with tables:

  element ID INT primary key ... Overview ID INT primary key ... Data ID INT Primary key view_ID floats key key element_id foreign key price ...  

I think all the observation_id Duplicate element_id s in overview_id . For example, if I have data record:

  1 | 50 | 23 4.5 2 50 | 24 | 9.93 | 66 | 23 4.4 4 66 | 23 4.1  

will then report the query overview_id 66 because it contains element_id 23 .

(I am using PostgreSQL, but this is probably a basic SQL question.)

Use counting () Overall, with the 'Happening' section:

 select_view, select element_id, Element_id count (*)> 1 

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -