sql - Select rows with the same field values -


how can query records show twice in table?

currently table looks this:

number   date                  recordt     readloc 123      08/13/13 1:00pm       n           gone 123      08/13/13 2:00pm       p           home 123      08/13/13 3:00pm       n           away 123      08/13/13 4:00pm       n           away 

i need query select records have same 'value' in recordt field , same 'value' in readloc field.

so result above show query:

number   date                  recordt     readloc 123      08/13/13 3:00pm       n           away 123      08/13/13 4:00pm       n           away 

i trying subselect this:

select t.number, t.date, n.recordt, n.readloc table1 t join table2 n on t.number = n.number t.number in (select t.number table1 group t.number having count(t.number) > 1 ) , n.readloc in (select n.readloc table2 group n.readloc having count(n.readloc) > 1 ) 

select a.* table1 join (select recordt, readloc       table1       group recordt, readloc       having count(*) > 1       )b on a.recordt = b.recordt  , a.readloc = b.readloc 

sql fiddle


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -