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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:09:44+00:00 2026-06-06T00:09:44+00:00

What I have is two tables inside of a mysql database. One table contains

  • 0

What I have is two tables inside of a mysql database.

One table contains the field with the value "example@example.com"

The other table does not…

What I would like to do is check both tables for a field with a value that matches "example@example.com".

Here is my query which does not work:

(#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 13)

SELECT CASE WHEN
EXISTS (
    SELECT address, suburb, city, postCode, province
    FROM user_postal
    INNER JOIN user_info ON user_postal.id = user_info.id
    WHERE user_info.emailContact = 'example@example.com'
)
OR EXISTS (
    SELECT address, suburb, city, postCode, province
    FROM user_postal
    INNER JOIN user_business_info ON user_postal.id = user_business_info.id
    WHERE user_business_info.emailContact = 'example@example.com'
)

I would like to return the values of the fields address, suburb, city, postCode, province that match the id of the user with the email example@example.com. (This could be in either of the two tables but it is surely in one or the other)

Could anyone enlighten me as to where I am going wrong with this? Any information in this regard would be greatly appreciated. Thanks!

  • 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-06T00:09:45+00:00Added an answer on June 6, 2026 at 12:09 am

    How about this:

    SELECT address, suburb, city, postCode, province
    FROM user_postal
    INNER JOIN user_info ON user_postal.id = user_info.id
    WHERE user_info.emailContact = 'example@example.com'
    
    UNION
    
    SELECT address, suburb, city, postCode, province
    FROM user_postal
    INNER JOIN user_business_info ON user_postal.id = user_business_info.id
    WHERE user_business_info.emailContact = 'example@example.com'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables inside a database. One stores unique userNames and a unique
This is a HTML email. I have two tables inside each other. One set
Using PHP / MySQL I have two tables one is customers the other is
There are two tables, which have a relationship(one-to-many). There are Meals table which contains
I have a table inside a form. It has two columns, the first one
I have two tables one with ID and NAME table 1 ID | NAME
I have two tables: groups and group_members . The groups table contains all the
I have two tables with hierarchyid fields, one of which is a staging table
I have two tables in my database as following: Employee Table: Username, Name, Job,
I have a two tables. One table is actually populated by daily events while

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.