Hello,
I'm trying to get a Select query in a stored proc to give the correct results but all I've done so far is pull hair out. Maybe one of you gurus out there can help me!
I have a table with information like this (sorry, couldn't make this look right):
Field1......... .............. Field2
ABC............ .............6
XYZ123......... ............6
XYZ123......... ............14
XYZ123......... ............30
JKL456......... .............6
JKL456......... ............14
JKL456......... ............30
NOP987......... ...........14
NOP987......... ...........30
QRS001......... ...........6
QRS001......... ...........14
QRS001......... ...........30
I want to get a distinct list of Field1 where Field2 = 6 but only if Field1 occurs more than once. The result I'm looking for would be:
XYZ123
JKL456
QRS001
This is making me crazy! Anybody got any ideas? Thanks in advance.
I'm trying to get a Select query in a stored proc to give the correct results but all I've done so far is pull hair out. Maybe one of you gurus out there can help me!
I have a table with information like this (sorry, couldn't make this look right):
Field1......... .............. Field2
ABC............ .............6
XYZ123......... ............6
XYZ123......... ............14
XYZ123......... ............30
JKL456......... .............6
JKL456......... ............14
JKL456......... ............30
NOP987......... ...........14
NOP987......... ...........30
QRS001......... ...........6
QRS001......... ...........14
QRS001......... ...........30
I want to get a distinct list of Field1 where Field2 = 6 but only if Field1 occurs more than once. The result I'm looking for would be:
XYZ123
JKL456
QRS001
This is making me crazy! Anybody got any ideas? Thanks in advance.
Comment