Forum Moderators: open
Here is my drama... I need to query this:
where (Column2 = 14 AND Column2 = 15) and active = 'y'
I a result set that has all records where there is active = 'y' for both Column2=14 and Column2=15
I can't figure this out...
I can do it so it returns me 14 and 15 with at least one of them as y, but not both.
I tried:
select * from table where (Column2 = 14 and Column2 = 15) and active = 'y'
Of course, this returns nothing, since both can't be 14 and 15 at the same time.
So I tried:
select * from table where ((Column2 = 14 or Column2 = 15) and active = 'y')
And this returns a result set, but not what I want...
I need to only return results in column1 that have:
column2 = 14 and active = 'y'
column2 = 15 and active = 'y'
both conditions must be true.
Any help? thanks guys!
Anyone know what is wrong with this query...
SELECT DISTINCT Vendors . * , packageFeatures.providerId, packages.pricing
FROM Vendors, packageFeatures, packages
WHERE (
Vendors.id = packages.VendorId
AND Vendors.id = packageFeatures.providerId
)
AND (
packageFeatures.providerId = (
SELECT *
FROM packageFeatures
WHERE featureId =32
AND active = 'y'
)
AND packageFeatures.providerId = (
SELECT *
FROM packageFeatures
WHERE featureId =82
AND active = 'y'
)
)
AND (
Vendors.type = 'small'
)
AND Vendors.hidden = 'n'
LIMIT 0 , 30