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

  • Home
  • SEARCH
  • 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 7495541
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T18:12:14+00:00 2026-05-29T18:12:14+00:00

Is it possible to get data from two exactly the same tables and print

  • 0

Is it possible to get data from two exactly the same tables and print them? Currently I am able to search in TABLE1 but not in TABLE2 as well.

EDITTED

$name= $_SESSION['NAME'];

USER 
ID - NAME
1 - AAAA
2 - BBBB
3 - CCCC
4 - DDDD
5 - EEEE

TABLE1
ID - CODE - BUYSELL
1 -A - Buying
2 - A - Buying
3 - B Buying
4 - B - Selling
5 - C - Selling

 "SELECT * from TABLE1, TABLE2, USER WHERE '$person' = USER.NAME 
    AND TABLE1.ID = USER.ID"; 

TABLE2
ID - CODE - YESNO - CAR
1 - A - YES - VOLVO
2 - B - YES - FORD
3 - C - YES - M
4 - D - NO - BMW
5 - A - NO - VOLVO

(AND TABLE2.ID = USER.ID?????)

I want all to search both tables 1 and 2? But adding TABLE2.ID = USER.ID is basically looking for the same values in both tables. So if I wanted CODEs for USERID 1 from table1 and 2.

Is it possible under 1 query or 2?

  • 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-29T18:12:15+00:00Added an answer on May 29, 2026 at 6:12 pm

    Use UNION to combine the results of two queries into one:

    (SELECT id, name AS value, "users" AS tbl_name FROM users WHERE ...)
    UNION
    (SELECT id, code AS value, "codes" AS tbl_name FROM codes WHERE ...)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to get data from remote server using JUST TSQL? I mean
Is it possible for a web page using Javascript to get data from another
Anybody know if it's possible? I'm trying to get the data by using the
Possible Duplicate: Get all files from VSS for a given date? I need to
Is it possible to get notified (without polling, but via an event) when a
I'm using the following to get data from database in a php file: $query_pedVR
I'm basically trying to get all touch event data from something like a system
I know that this isn't exactly normalised, but bringing all of the localised data
I am trying to post some data and get some data back from a
is it possible to get all records from database when you do not enter

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.