ES-Components
asked on
How Do I Get Select Statement To Return Correct Results?
See select statement below. I am not getting the expected results. We need:
Requirements:
1. Must enter the Date Range, you enter PrLine Only - Get results
2. Must enter the Date range, you enter Desc only - Get Results
3. Must enter the Date Range, you enter PrLine and Desc - Get Results
Can the requirements be met with one select Statement?
SELECT *
FROM BidsAndNotesFINAL
WHERE (BidDetailFinal_PrLine LIKE '%PriceLine%') OR (BidDetailFinal_Desc LIKE '%Desc%') AND (BidDetailFinal_OrdDate BETWEEN #varStartRange# AND #varEndRange#)
Requirements:
1. Must enter the Date Range, you enter PrLine Only - Get results
2. Must enter the Date range, you enter Desc only - Get Results
3. Must enter the Date Range, you enter PrLine and Desc - Get Results
Can the requirements be met with one select Statement?
SELECT *
FROM BidsAndNotesFINAL
WHERE (BidDetailFinal_PrLine LIKE '%PriceLine%') OR (BidDetailFinal_Desc LIKE '%Desc%') AND (BidDetailFinal_OrdDate BETWEEN #varStartRange# AND #varEndRange#)
ASKER
Your suggestion did not work. If I enter just the PrLine and Date Range I do not get the resuslts.
In your suggestion, if I enter PrLine and Desc and Date range it works.
I am beginning to think that I will need three separate query statements. I am not sure if I can do what we need in just one statement.
In your suggestion, if I enter PrLine and Desc and Date range it works.
I am beginning to think that I will need three separate query statements. I am not sure if I can do what we need in just one statement.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
tHANK YOU....
SELECT *
FROM BidsAndNotesFINAL
WHERE ( (BidDetailFinal_PrLine LIKE '%PriceLine%') OR (BidDetailFinal_Desc LIKE '%Desc%') ) AND (BidDetailFinal_OrdDate BETWEEN #varStartRange# AND #varEndRange#)