Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help with excel ms query with criteria

Status
Not open for further replies.

olmos

Technical User
Joined
Oct 25, 2000
Messages
135
Location
US
In excel I am using Get external data. Then I am picking up information from an sqlserver.

My query is not giving the results back correctly.
I get all the data back when I have entered certain criteriae.
In the criteria box, I have 3 fields.

Eventdate is a criteria field, value is Between [Enter Start Date:] And [Enter End Date:]
and I also have the criteria field DisplaySrcIPAddress, in value I put [Enter Source IP:] and DisplayDestIPAddress is another criteria field, but this one I put the value in the OR section- [Enter Destination IP:]

The eventdate is a datetime field with a format like 2003-04-08 23:12:01.000

This is the sql:

SELECT EventDate, SrcIP, DestIP
FROM Events, EventParams
WHERE EventID = EventPar.EventID AND ((Events.EventDate Between ? And ?) AND (Events.DisplaySrcIPAddress=?) OR (Events.DisplayDestIPAddress=?))

But it gives me back all the data.
How can I fix this?

thanks,
olmos
 
Hi,

Can't tell if you have a problem with your boolean logic, 'cuz I don't know what the requirement is.

But here's my suggestion.

Start with ONE criteria...
Code:
WHERE EventID = EventPar.EventID AND Events.DisplayDestIPAddress=?
and build from there after making sure that works.


Skip,
Skip@TheOfficeExperts.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top