Ask a Question related to Coldfusion Database Access, Design and Development.
-
hml398 #1
SQL Query Not Returning Correct Results
I am trying to pull all records that are set for mailing and are from every
state except for Nebraska and some counties in Iowa. It isn't pulling
correctly. Any help would be greatly appreciated.
SELECT HS_SATCode.School, HS_SATCode.Add1, HS_SATCode.City, HS_SATCode.State,
HS_SATCode.[Zip Code], HS_SATCode.county, HS_SATCode.mail_list
FROM HS_SATCode
WHERE (((HS_SATCode.State)<>'NE') AND ((HS_SATCode.mail_list)=1)) OR
(((HS_SATCode.State)='IA') AND ((HS_SATCode.county)<>'Adair' And
(HS_SATCode.county)<>'adams' And (HS_SATCode.county)<>'audubon' And
(HS_SATCode.county)<>'buena vista' And (HS_SATCode.county)<>'calhoun' And
(HS_SATCode.county)<>'carroll' And (HS_SATCode.county)<>'cass' And
(HS_SATCode.county)<>'cherokee' And (HS_SATCode.county)<>'clay' And
(HS_SATCode.county)<>'crawford' And (HS_SATCode.county)<>'dickinson' And
(HS_SATCode.county)<>'fremont' And (HS_SATCode.county)<>'greene' And
(HS_SATCode.county)<>'guthrie' And (HS_SATCode.county)<>'harrison' And
(HS_SATCode.county)<>'ida' And (HS_SATCode.county)<>'lyon' And
(HS_SATCode.county)<>'mills' And (HS_SATCode.county)<>'monona' And
(HS_SATCode.county)<>'montgomery' And (HS_SATCode.county)<>'o''brien' And
(HS_SATCode.county)<>'osceola' And (HS_SATCode.county)<>'page' And
(HS_SATCode.county)<>'pottawattamie' And (HS_SATCode.county)<>'plymouth' And
(HS_SATCode.county)<>'ringold' And (HS_SATCode.county)<>'sac' And
(HS_SATCode.county)<>'shelby' And (HS_SATCode.county)<>'sioux' And
(HS_SATCode.county)<>'tayland' And (HS_SATCode.county)<>'union' And
(HS_SATCode.county)<>'woodbury') AND ((HS_SATCode.mail_list)=1))
ORDER BY HS_SATCode.mail_list, HS_SATCode.State, HS_SATCode.county
hml398 Guest
-
Complex join = no results (for a query that shouldreturn results)
I am trying to use a rather complex join that returns many results when the SQL server is queried directly, but returns no results when used on a... -
Query results don't display properly in results table.IGNORE PREVIOUS
:disgust; I need to display the results of a query. The query runs properly. My problem is having specific results display in specific locations in... -
Query results don't display properly in results table.
:disgust; I need to display the results of a query. The query runs properly. My problem is having specific results display in specific locations in... -
returning results in rows
I have a db with the fields Day, Month, Year and Message. How can I select all of the messages for the current week starting with sunday and return... -
Returning results where the match is not always there!!!
Hi All I have two tables that I need to match customer data on. The first table holds all of the customers billing info Title Name Address... -
Dan Bracuk #2
Re: SQL Query Not Returning Correct Results
Wow, that's a lotta brackets. And most of them are unnecessary. Let's reduce
it a bit.
WHERE
(
HS_SATCode.State)<>'NE' AND HS_SATCode.mail_list =1
OR (HS_SATCode.State='IA' AND HS_SATCode.county<>'Adair' )
)
Can you see how this will send mail to Nebraska?
Dan Bracuk Guest
-
MikerRoo #3
Re: SQL Query Not Returning Correct Results
Microsoft query-builder wizards add extra parentheses like that.
Good example of the GIGO principle.
MikerRoo Guest



Reply With Quote

