Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8321117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T22:54:27+00:00 2026-06-08T22:54:27+00:00

This is sample my database: status date Q 2012-08-02. Q 2012-08-01. Q 2012-09-03. Here

  • 0

This is sample my database:

  • status date

  • Q 2012-08-02.

  • Q 2012-08-01.
  • Q 2012-09-03.

Here if i run my application means i wish to display 2. This is do following information.
– check the database current month+status=Q after display how many matched information is totally you are got.for example totally 2 means the output is displayed 2.

Already i done get the total count value for current date+status=Q information.it is successfully completed.
Here i have use this code:

public class RetailerWs {
public int data(){
int count=0;

//count++;

try{
  Class.forName("com.mysql.jdbc.Driver");
  Connection con = DriverManager
     .getConnection("jdbc:mysql://localhost:3306/pro","root","");

  PreparedStatement statement =  con
     .prepareStatement("select * from orders where status='Q' AND date=CURDATE()");
  ResultSet result = statement.executeQuery();

  while(result.next()) {
    // Do something with the row returned.
    count++; //if the first col is a count.
  }     
}
catch (Exception exc) {
  System.out.println(exc.getMessage());
}


return count;
 }
 }

the another class is:

public class Demo {
public static void main(String[] args){
    RetailerWs obj = new RetailerWs();
    System.out.println(obj.data());
 }

}

the above code for get the information for current date + status=Q.
please help me how is write the code for current month + status=Q….

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T22:54:28+00:00Added an answer on June 8, 2026 at 10:54 pm

    It should be:

    select * from orders where status='Q' AND MONTH(date) = MONTH(CURDATE())
    

    See THIS for more information on the date and time functions of MySQL.

    For the week, try:

    select * from orders where status='Q' AND WEEK(date) = WEEK(CURDATE())
    

    For the week in THIS year, try:

    select * from orders where status='Q' AND WEEK(date) = WEEK(CURDATE()) AND YEAR(date) = YEAR(CURDATE())
    

    To have it all in one check use:

    select * from orders where status='Q' AND YEARWEEK(date) = YEARWEEK(CURDATE())
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application which posts progress/status messages as it runs (it's a database
Assume the following trivial class: package Sample; public class Status { private Long id;
This can certainly be done using a simple script and reading the database. I
I know this is most-likely a simple question but when you restore a database
Hello I`ve created simple WFC DataService and connected entit model with my database. This
I have a simple problem with XML got from database. Now, this XML can
I'm trying to develop a simple php based schedule ... This is my database
Consider this sample class, class TargetClass { private static String SENSITIVE_DATA = sw0rdfish; private
In this sample code the URL of the app seems to be determined by
in this sample method/message: -(void) setNumerator:(int) n { numerator = n; } What does

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.