Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6133837
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:16:46+00:00 2026-05-23T17:16:46+00:00

Hi I have a query that will be retrieving the members who have the

  • 0

Hi I have a query that will be retrieving the members who have the pay method type is cash and memberstatustype have id’s 2 , 3 , 6 . The query working fine when the members have pay method type is cash and dd and card but it will retrieve the all details of members who dont have paymethod is card and this is my query

SELECT members.member_Id, members.member_Lastname, members.member_Firstname, members.member_PostCode,members.member_Reference,  members.member_Dob,30*memberToMship_ChargePerPeriod/DateDiff(memberToMship_EndDate, memberToMship_StartDate) As monthly_amount, mshiptypes.mshipType_Name, mshipstatustypes.mshipStatusType_Name,membertomships.memberToMship_EndDate,IF(mshipOption_Period='year', TIMESTAMPDIFF (YEAR,memberToMship_StartDate, memberToMship_EndDate),  TIMESTAMPDIFF (MONTH ,memberToMship_StartDate,memberToMship_EndDate ) ) *memberToMship_ChargePerPeriod As Total 
FROM members 
LEFT JOIN membertomships ON membertomships.member_Id = members.member_Id 
LEFT JOIN mshipstatustypes ON mshipstatustypes.mshipStatusType_Id = membertomships.mshipStatusType_Id 
LEFT JOIN mshipoptions ON mshipoptions.mshipOption_Id = membertomships.mshipOption_Id 
LEFT JOIN mshiptypes ON mshiptypes.mshipType_Id = mshipoptions.mshipType_Id 
WHERE 
    membertomships.memberToMship_PayMethod='Card' OR  mshipstatustypes.mshipStatusType_Id='2' OR  mshipstatustypes.mshipStatusType_Id = '3'  OR mshipstatustypes.mshipStatusType_Id='6';

can any one pls help me on this ….
am i doing any thing wrong in “OR condition”

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T17:16:47+00:00Added an answer on May 23, 2026 at 5:16 pm

    Your WHERE clause needs to look like this:

    WHERE membertomships.memberToMship_PayMethod='Card' 
    AND (mshipstatustypes.mshipStatusType_Id='2' 
    OR  mshipstatustypes.mshipStatusType_Id = '3'  
    OR mshipstatustypes.mshipStatusType_Id='6');
    

    Your original query looks for people who have either one of those:

    • membertomships.memberToMship_PayMethod=’Card’
    • mshipstatustypes.mshipStatusType_Id=’2′
    • mshipstatustypes.mshipStatusType_Id=’3′
    • mshipstatustypes.mshipStatusType_Id=’6′

    What you wanted was people who have

    • membertomships.memberToMship_PayMethod=’Card’

    AND one of the following:

    • mshipstatustypes.mshipStatusType_Id=’2′
    • mshipstatustypes.mshipStatusType_Id=’3′
    • mshipstatustypes.mshipStatusType_Id=’6′
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a query that will be put into a procedure, and it will
I have a page a query that will set a table to 0 or
I have a problem with an sql query that will not work if I
I want to add an extra field to my query that will have the
I have a simple query: $query = new WP_Query('showposts=5'); that will obviously display 5
I have a PHP code, that will run a Select query to check if
i would like to have a query that will solve my problem in native
I have a query that will return results from 2 tables into 1 using
I have a query that will return a value in this case and inventory
I need an sql query that will retrieve all items that have both tags,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.