Should be an easy question (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


hzarabet -> Should be an easy question (3/15/2001 15:46:00)

I should know this one by now but...

I though when you use AND in your WHERE statement that you return only the results COMMON to both parts of the WHERE statement. Instead I just get everything, not just the common records.

For example

Car makers: BMW Ford Chevy
Motorcycle makers: BMW Honda Harley

If my where statement is

WHERE Cars="Cars" AND Motorcylcles="Motorcycles"

I want this to return JUST BMW

it is now returning

BMW, Chevy, Ford, Honda and Harley

Thanks in advance


------------------
www.Signingshotline.com lists EVERY upcoming athlete autograph appearance in the US and Canada





Spooky -> RE: Should be an easy question (3/15/2001 23:11:00)

What does the actual string look like?




hzarabet -> RE: Should be an easy question (3/16/2001 23:25:00)

fp_sQry="SELECT Players.Player, Sports.Sport, Events.EventDate, Events.StartTime, Events.EndTime, Locations.Location, Locations.Address, Locations.City, Locations.State, Events.Tips, Events.Tips_Additional, Events.MailOrder, Events.Notes, Promoters.Promoter, Promoters.PromoterPhone, Promoters.PromoterEmail, Promoters.PromoterWebSite, Events.ListingDate, Players.Teams1, Players.Teams2, Players.Teams3, Players.Teams4, Players.Teams5, Players.Teams6, Players.Teams7, Players.Teams8, Players.Teams9, Players.Teams10, Players.Teams11, Players.Teams12, Players.Records1, Players.Records2, Players.Records3, Players.Records4, Players.Records5, Players.Records6, Players.Records7, Players.Records8 FROM (Sports INNER JOIN Players ON Sports.SportCode = Players.SportCode) INNER JOIN ((Events INNER JOIN Locations ON Events.Location = Locations.Location) INNER JOIN Promoters ON Events.Promoter = Promoters.Promoter) ON Players.Player = Events.Player WHERE ((EventDate>=convert(char(24),getdate(),1) AND ([Promoters].[Promoter] = '::Promoter::' OR Mailorder LIKE '::Mailorder::%' OR Sport = '::Sport::' OR Big10 = '::Big10::' OR Notes = '::Notes::' OR EventDate = '::EventDate::' OR ListingDate >='::ListingDate::' OR State = '::State::' OR [Players].[Player] LIKE '%::Player::%' OR EventDate<=convert(char(24),'::Upcoming::',1) OR Express LIKE '%::Express::%' OR Teams1 = '::Teams::' OR Teams2 = '::Teams::' OR Teams3 = '::Teams::' OR Teams4 = '::Teams::' OR Teams5 = '::Teams::' OR Teams6 = '::Teams::' OR Teams7 = '::Teams::' OR Teams8 = '::Teams::' OR Teams9 = '::Teams::' OR Teams10 = '::Teams::' OR Teams11 = '::Teams::' OR Teams12 = '::Teams::' OR Records1 = '::Record::' OR Records2 = '::Record::' OR Records3 = '::Record::' OR Records4 = '::Record::' OR Records5 = '::Record::' OR Records6 = '::Record::' OR Records7 = '::Record::' OR Records8 = '::Record::')))ORDER BY state, eventdate"

------------------
www.Signingshotline.com lists EVERY upcoming athlete autograph appearance in the US and Canada





Spooky -> RE: Should be an easy question (3/17/2001 20:58:00)

I had to ask didnt I

Will the same statement provide the answer when you query against a database (but with hard coded values instead of ::formvalues:: ?





hzarabet -> RE: Should be an easy question (3/17/2001 23:16:00)

if I hardcode something like:

www.signingshotline.com/results.asp?player=bob&?state=new%20york

I get EVERY player named Bob and EVERY signer in New York.

Actaully, I take that back. I am JUST getting EVERY player named Bob.

So I have the same problem with hardcoding.

I thought you knew my SQL by heart by now

------------------
www.Signingshotline.com lists EVERY upcoming athlete autograph appearance in the US and Canada

[This message has been edited by hzarabet (edited 03-17-2001).]





hzarabet -> RE: Should be an easy question (3/21/2001 20:06:00)

I was faaling a few days back so I bumped up.

------------------
www.Signingshotline.com lists EVERY upcoming athlete autograph appearance in the US and Canada





Mojo -> RE: Should be an easy question (3/21/2001 20:28:00)

In the hyperlink query you have listed I see 2 question (?) marks in the query. I belive you should only have one right at the end of the link... where the query begins...

www.signingshotline.com/results.asp?player=bob&state=new%20york

That is still not returning what you want though.

Joe





hzarabet -> RE: Should be an easy question (3/21/2001 20:41:00)

Yeah Joe...I agree, nix the second ?, but it is still giving me "the universe" instead of the "common records" between the two.

------------------
www.Signingshotline.com lists EVERY upcoming athlete autograph appearance in the US and Canada





hzarabet -> RE: Should be an easy question (3/22/2001 15:57:00)

This should be an easy one right?

------------------
www.Signingshotline.com lists EVERY upcoming athlete autograph appearance in the US and Canada





hzarabet -> RE: Should be an easy question (3/23/2001 20:02:00)

Hmmmm

------------------
www.Signingshotline.com lists EVERY upcoming athlete autograph appearance in the US and Canada





Spooky -> RE: Should be an easy question (3/23/2001 20:01:00)

Ok, Ill bite. Wheres the AND
I only see one and, the rest OR's




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.125