INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

get current month and current year data from DB2 table

get current month and current year data from DB2 table

get current month and current year data from DB2 table

(OP)
Hello. Please help as this is urgent. I have a DB2 table where I need to get the current month and year from table X. gl_date is defined as date and is 10 bytes. Here is the query I used. It works if I use the month or the year but not both. Thank you.

select *
from table x
where month(gl_date) = month(current date)
and year(gl_date) = year(current date);

 

RE: get current month and current year data from DB2 table

Hi rulala,
The query looks ok to me, but maybe I have misunderstood what you are asking for.

Could you possibly show some data on table x with the results that you are expecting. That way we will know exactly what you are after.

Regards,

Marc

RE: get current month and current year data from DB2 table




Hi,

Quote:

It works if I use the month or the year but not both. Thank you.
HUH???

CODE

where month(gl_date) = month(current date)
and year(gl_date) = year(current date);
Is that not exactly what you have???

Skip,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close