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 8349853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:08:03+00:00 2026-06-09T08:08:03+00:00

Have a look at the following SQL statement select * from PhoneData where names

  • 0

Have a look at the following SQL statement

select * 
from PhoneData 
where  names = 'yohan' 
    and nickName = 'yoises' 
    and mobileNumber1 = 0000000000 or mobileNumber2 = 0000000000

In here, there is a problem. That is this return all the results where the phone number is same. There are 2 rows with the same phone number, so it returns both, by ignoring the name, nick name and all. I assume this is because of the “or” statement. How can I solve this? I need to get details who’s name=yohan and mobileNumber1 or mobileNumber2 = 000000000.

  • 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-06-09T08:08:04+00:00Added an answer on June 9, 2026 at 8:08 am

    You need some brackets around your OR statements, like this:

    select * 
    from PhoneData 
    where names = 'yohan' 
        and nickName = 'yoises' 
        and (mobileNumber1 = 0000000000 
            or mobileNumber2 = 0000000000)
    

    Without brackets, it is effectively doing this:

    select * 
    from PhoneData 
    where (names = 'yohan' 
        and nickName = 'yoises' 
        and mobileNumber1 = 0000000000) 
            or mobileNumber2 = 0000000000
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written the following SQL statement in MySQL : USE my_database; SELECT *
I have the following select SQL that does a basic select statement although it
I have got the following SQL statement (SQL Server): DECLARE @atr nvarchar(255), @con nvarchar(1000),
I have the following SQL statement which returns Not unique table/alias . I'm fairly
I have the following sql statement - it's trying to find all the zipcodes
I have the following error when trying to import .sql file into MYSQL from
Possible Duplicate: Python JSON serialize a Decimal object I have the following SQL: SELECT
Have a look at following scenario: public class ParentClass { private Integer testVar =
I have HttpClient 4.1. Please have a look at following program: import org.apache.http.client.methods.*; import
Have a look at the following code you are not required to read the

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.