Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

display days that have a specific month !!

Posted on 2002-04-06
14
Medium Priority
?
216 Views
Last Modified: 2013-11-24
suppose i have table that contains days
like 26-01-1979 and i want to display all the days that
have the same month and year .

for example :12-01-1979 , 04-01-1979
by using sql command and java servlet
0
Comment
Question by:star5
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 5
  • 2
14 Comments
 
LVL 3

Expert Comment

by:msterjev
ID: 6923513
SELECT * FROM Table1 WHERE day LIKE '%-01-1979'

Build this string dinamically!
0
 

Author Comment

by:star5
ID: 6923574
this is fixed !!
SELECT * FROM Table1 WHERE day LIKE '%-01-1979'

the day should be entered by the user
into two texts: one holds the month ,the other holds the year
0
 
LVL 3

Expert Comment

by:msterjev
ID: 6923584
I don't understand your comment.Did I answer your question. Where are the points?
0
Not sure which OpenStack Certification to get?

So you’ve realized you might want to get certified in OpenStack, but you’re not sure what the benefits might be or even which one you should take. You know there are several certification courses you can choose from, but how do you know which one is right for you?

 

Author Comment

by:star5
ID: 6924080
no u didn't answer the Question,
what u are suggesting is for fixed day
the day should be a variable that can be entered by the user.
the user enter the name of the month in a text and the year in another text

SELECT * FROM Table1 WHERE day LIKE 'user entered day'

0
 
LVL 3

Expert Comment

by:msterjev
ID: 6924622
String month=Request.getParameter("month");
String day=Request.getParameter("year");
String sqlString="SELECT * FROM Table1 WHERE day LIKE '%-"+month+"-"year";
0
 

Author Comment

by:star5
ID: 6924861
are sure about this code
String sqlString="SELECT * FROM Table1 WHERE day LIKE '%-"+month+"-"year";

i think there is a mistake in the quataion marks ""
would u check it please ,
i think it well work
0
 
LVL 3

Expert Comment

by:msterjev
ID: 6924939
String sqlString="SELECT * FROM Table1 WHERE day LIKE '%-"+month+"-"year'";
0
 
LVL 3

Expert Comment

by:msterjev
ID: 6924944
0
 

Author Comment

by:star5
ID: 6927376
not working
0
 

Author Comment

by:star5
ID: 6927393
it gives errors
0
 
LVL 1

Expert Comment

by:jose_tijo
ID: 6927489
String month=Request.getParameter("month");
String day=Request.getParameter("year");
String sqlString="SELECT * FROM Table1 WHERE day LIKE '%-" + month + "-" + year;
0
 

Author Comment

by:star5
ID: 6927893
not working jose_tijo it shows an error .
some missing Quationts or apostofe
0
 
LVL 1

Accepted Solution

by:
jose_tijo earned 20 total points
ID: 6927908
Hi

Try this star5

String month=Request.getParameter("month");
String day=Request.getParameter("year");
String sqlString="SELECT * FROM Table1 WHERE day LIKE '%-" + month + "-" + year + "'";

Tijo
0
 

Author Comment

by:star5
ID: 6928017
when i used :
int month=9;
int year=2001;
   
strSQL="SELECT * FROM Training WHERE startdate LIKE '"+month+"/"+"%"+"/"+year+"'";

it works correctly
note :i'm using doget


but when i tried to read the values from an html page
it shows errors, the html page has method = post

int month;
int year;
month = req.getParameter(month);  
strSQL="SELECT * FROM Training WHERE startdate LIKE '"+month+"/"+"%"+"/"+year+"'";

what is wrong with this
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Suggested Courses

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question