Jump to content

Combine results from multiple members who have like categories using OR


HalRau
Go to solution Solved by Barand,

Recommended Posts

Members can be in up to three different categories, primary, secondary and tertiary. What I would like to do is have all members show in the result of a query string that looks for all members in a specific category no matter if it is their primary, secondary and tertiary category. Example: If say a visitor is looking for all members whose business category = 5 it will find and list all members whose BizCat1, BizCat2 OR BizCat3 equals 5

Right now I have this query string that finds all members in the members table with a BizCat1 = to %s. %s is a URLpararmeter variable passed over to the page.

$query_RSwbamembers = sprintf("SELECT * FROM members WHERE BizCat1 = %s AND LiveOnWeb = 1 ORDER BY BusinessName ASC", GetSQLValueString($colname_RSwbamembers, "int"));

I would like the query result to also includes members whose BiZCat2 = %s or BiZCat3 = %s (the same value as BizCat1) which are additional fields in the table.

 

Any suggestion on how to do this appreciated.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.