i am working on a java project,
one of its web pages includes this query:-

select pname,age,gender,dscrptn from patient where curdate='05-17-2011' and docref='arshdeep' and meet='no'

but it is not working, i executed this in MS SQL,
BUT ITS SHOWING ONLY THE COLUMN NAMES THERE.
i.e
pname age gender dscrptn

please help, please........

Change your date to '2011-05-17' (YY-MM-DD)

doesn't matters, i havent selected that column with date data type, i have used varchar(50) for that, as i dnt need to manipulate date in any way.....

Usually it just means that there are no rows with all of the matching criteria. I suggest you try execute the query three times, each time including only ONE of the criteria in the "where" clause.

-- execution 1
select pname, age, gender, dscrptn 
from patient 
where 
curdate='05-17-2011'
--docref='arshdeep'
--meet='no'

-- execution 2
select pname, age, gender, dscrptn 
from patient 
where 
--curdate='05-17-2011'
docref='arshdeep'
--and meet='no'

-- execution 3
select pname, age, gender, dscrptn 
from patient 
where 
--curdate='05-17-2011'
--docref='arshdeep'
meet='no'

That will help isolate what part of the query is having an issue (if any). If you get data returned, that means there is data for that particular criterion. Then start using the criteria in pairs, you can determine which combination causes you to not get data returned. It may just be that no rows match your criteria, and there's no real problem with the query.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.