M
middletree
I had a query like this:
select P.PersonalID,P.FName,P.LName,P.PreferredName,PG.GiftID,PA.AreaID,
PAB.AbilityID, PP.PeopleID
FROM Personal P
INNER JOIN PersonalGift PG ON P.PersonalID = PG.PersonalID
INNER JOIN PersonalArea PA ON P.PersonalID = PA.PersonalID
INNER JOIN PersonalAbility PAB ON P.PersonalID = PAB.PersonalID
INNER JOIN PersonalPeople PP ON P.PersonalID = PP.PersonalID
WHERE PG.GiftID LIKE *
AND PA.AreaID LIKE *
AND PAB.AbilityID LIKE *
AND PP.PeopleID LIKE *
(where the * could conveivably be concatenated with integers. Ex: "AND
PP.PeopleID LIKE 16*"
and it gave me an error about a missing operator. After some experimenting,
I found that if I just dropped the asterisk, and had an integer there, like
"AND PP.PeopleID LIKE 16" it would work fine. But I was really hoping
that there would be a way to allow for the fact that for the WHERE and the
AND lines you see above, there may be nothing or there may be one integer
for each one.
So is there something I am missing in the syntax? (BTW, I got this idea
from an MVP who responded to a post a few days ago.)
This is for a classic ASP app, and I have found a way to code around it by
requiring people to select an item from the Gift dropdown (where you see the
word WHERE in the query above), and leaving the other things optional. But
I'd like to have all 4 of them optional.
select P.PersonalID,P.FName,P.LName,P.PreferredName,PG.GiftID,PA.AreaID,
PAB.AbilityID, PP.PeopleID
FROM Personal P
INNER JOIN PersonalGift PG ON P.PersonalID = PG.PersonalID
INNER JOIN PersonalArea PA ON P.PersonalID = PA.PersonalID
INNER JOIN PersonalAbility PAB ON P.PersonalID = PAB.PersonalID
INNER JOIN PersonalPeople PP ON P.PersonalID = PP.PersonalID
WHERE PG.GiftID LIKE *
AND PA.AreaID LIKE *
AND PAB.AbilityID LIKE *
AND PP.PeopleID LIKE *
(where the * could conveivably be concatenated with integers. Ex: "AND
PP.PeopleID LIKE 16*"
and it gave me an error about a missing operator. After some experimenting,
I found that if I just dropped the asterisk, and had an integer there, like
"AND PP.PeopleID LIKE 16" it would work fine. But I was really hoping
that there would be a way to allow for the fact that for the WHERE and the
AND lines you see above, there may be nothing or there may be one integer
for each one.
So is there something I am missing in the syntax? (BTW, I got this idea
from an MVP who responded to a post a few days ago.)
This is for a classic ASP app, and I have found a way to code around it by
requiring people to select an item from the Gift dropdown (where you see the
word WHERE in the query above), and leaving the other things optional. But
I'd like to have all 4 of them optional.