Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

What is wrong with my Select Query?

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Hi,
I have 2 tables in my database Tier and Aff
(Aff_id is PK of Aff and FK of Tier)
I am not sure why the following query is returning 3 records when it should return one.
SQL> select tier.TIER_ID
2 FROM tier , aff
3 where tier.AFF_ID =(select AFF_ID from aff where AFF_ABBR_TXT='AAA')
4 AND (MIN_DPST_AMT <= 501)
5 and (MAX_DPST_AMT>= 501);

TIER_ID
----------
309
309
309
MIN_DPST_AMT, MAX_DPST_AMT are columns in TIER table.
Also I must tell you tier table has only one record with Tier ID 309 .
What is wrong in the query?
Thanks,
Ameer
 
author & internet detective
Posts: 42145
937
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Closing accidental duplicate thread
 
    Bookmark Topic Watch Topic
  • New Topic