Jump to content

Archived

This topic is now archived and is closed to further replies.

DanielStead

Anyone help with this simple query

Recommended Posts

This query works fine

 

SELECT ParcelID, x, y FROM Polygons WHERE Parish = 'Stadhampton' AND ParcelID = 91 AND x BETWEEN 460500 AND 461000

 

but this query selects multipule ParcelID's when i only want the ones for 91. It seems to be the OR that causes the query not to function as how i thought it would.

 

SELECT ParcelID, x, y FROM Polygons WHERE Parish = 'Stadhampton' AND ParcelID = 91 AND x BETWEEN 460500 AND 461000 OR y BETWEEN 199000 AND 199500

 

In english i want the query to select PareclID, x and y if parish = stadhampton and ParcelId = 91 and (if (x is between 460500 and 461000) OR (y is between 199000 AND 199500)

 

Can anyone help me with this?

 

Share this post


Link to post
Share on other sites

[!--quoteo(post=327336:date=Dec 14 2005, 04:49 PM:name=DanielStead)--][div class=\'quotetop\']QUOTE(DanielStead @ Dec 14 2005, 04:49 PM) 327336[/snapback][/div][div class=\'quotemain\'][!--quotec--]

This query works fine

 

SELECT ParcelID, x, y FROM Polygons WHERE Parish = 'Stadhampton' AND ParcelID = 91 AND x BETWEEN 460500 AND 461000

 

but this query selects multipule ParcelID's when i only want the ones for 91. It seems to be the OR that causes the query not to function as how i thought it would.

 

SELECT ParcelID, x, y FROM Polygons WHERE Parish = 'Stadhampton' AND ParcelID = 91 AND x BETWEEN 460500 AND 461000 OR y BETWEEN 199000 AND 199500

 

In english i want the query to select PareclID, x and y if parish = stadhampton and ParcelId = 91 and (if (x is between 460500 and 461000) OR (y is between 199000 AND 199500)

 

Can anyone help me with this?

 

Try this daniel:

 

select PareclID, x and y FROM Polygons WHERE ((Parish = 'Stadhampton' AND ParcelID = 91) || ((x BETWEEN 460500 AND 461000)|| (y BETWEEN 199000 AND 199500)))

 

 

Share this post


Link to post
Share on other sites

I'm really horrible at this stuff (and new) and have no clue really but is there a possibilty that grouping [x BETWEEN 460500 AND 461000 OR y BETWEEN 199000 AND 199500] together might help...I think im trying to say so that it looks for 3 sections of infomation (the Parish, ParcelID, and then that group)..?...or maybe put x and its numbers and y and its number to variables..?...maybe using the group by clause..?...

 

Sorry, I duno..just thought I would say a couple ideas that come to mind...

 

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.