March 6, 2008 at 7:04 am
I agree with soultower that you don't need any WHERE clause condition on 2nd column if you want to include all record of that column.
Your query will look like
SELECT
RefNumber,
ProjectName,
Type,
Details,
Assign,
StartDate,
EndDate,
ExHours,
ExMin,
CycleNumber,
ProjectStatus,
ImageNumber,
Status,
Id
FROM
tblInsertDetails
WHERE RefNumber = 'www'
cheers
March 6, 2008 at 11:58 am
Hi all,
I have a roblem to my where clause.
I want to search first coloumn given record and 2nd coloumn ALL records. So im confusing to get these two @ same time .
Anyone can help me please.
Example :-
SELECT RefNumber, ProjectName, Type, Details, Assign, StartDate, EndDate, ExHours, ExMin, CycleNumber, ProjectStatus, ImageNumber, Status, Id
FROM tblInsertDetails
WHERE (RefNumber = 'www') ??? (ProjectName =???)
there are somany projectnames. So i want to display that all and suitable ReferenceNumber.
March 6, 2008 at 12:56 pm
Maybe I'm missing something but if you want all records from column 2 then it doesn't need to be in the where clause.
SELECT col1, col2, col3 from myTable WHERE col1 = 'FOO'
March 6, 2008 at 8:18 pm
I dont clear with this answer. So if there are more than two criterias to search, is that theory applicable or not.
ex-
SELECT RefNumber, ProjectName, Type, Details, Assign, StartDate, EndDate, ExHours, ExMin, CycleNumber, ProjectStatus, ImageNumber, Status, Id
FROM tblInsertDetails
WHERE (RefNumber =@Var1) OR (ProjectName=@Var2) AND(Status = 1)
March 7, 2008 at 4:53 am
sampathsoft (3/6/2008)
I dont clear with this answer. So if there are more than two criterias to search, is that theory applicable or not.ex-
SELECT RefNumber, ProjectName, Type, Details, Assign, StartDate, EndDate, ExHours, ExMin, CycleNumber, ProjectStatus, ImageNumber, Status, Id
FROM tblInsertDetails
WHERE (RefNumber =@Var1) OR (ProjectName=@Var2) AND(Status = 1)
So in your example, you want all data
where
(RefNumber = @Var1 --this
OR
ProjectName = @Var2) --or this
AND Status = 1 --and all rows must have status = 1
Is this what you are asking? This is different from your original question.
If it was easy, everybody would be doing it!;)
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply