Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

DB2

 
Keerthi Pandey
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I want the query for this:

I have a table called ABC where I have many columns including ABC_ID, ABC_BGN_DT, ABC_END_DT. Now this ABC_ID is a foreign key in my another table ABC_YER. This table contains values for that ABC_ID beginning from ABC_BGN_DT to ABC_END_DT(one year in each table).

Now I want to query this second table(ABC_YER) for any duplicates/not matching(ABC_BGN_DT to ABC_END_DT) for a particular ABC_ID.

Also I need to query the same table(ABC_YER) if the first row begin date is not matching with the ABC_BGN_DT of ABC for a particular ABC_ID.

I am a newbie. Please help ASAP.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The trick with SQL queries is to write simpler queries and build up. For example,

Can you query for:
  • Do a join between tables 1 and 2
  • Restrict by date
  • Identify duplicates


  •  
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic