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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:04:44+00:00 2026-05-26T18:04:44+00:00

i have 3 tables that looks like this: game_table +———+————+————+———————-+———-+ | game_id | game_title

  • 0

i have 3 tables that looks like this:

game_table
+---------+------------+------------+----------------------+----------+
| game_id | game_title | sponser_id | game expiration date | prize_id |
+---------+------------+------------+----------------------+----------+
prize_table
+----------+---------------------------+------------+-------------+--------------------+--------------------------------------------+
| prize_id | prize_image_name          | prize_cost | prize_title | remaining_quantity | prize_description                          |
+----------+---------------------------+------------+-------------+--------------------+--------------------------------------------+
sponser_table
+------------+--------------+
| sponser_id | sponser_name |
+------------+--------------+

how do i build query that select all data from the 3 tables that
meat the statement that go’s something like pseudo code:

select all data from game_table and prize_table and sponser_table where   game_table.sponser_id = 2 and game_table.prize_id = 2 

i tried something like this :

SELECT game_list.*, prize_list.* ,sponser_list.* FROM game_list, prize_list,sponser_list
WHERE game_list.sponser_id=2  And  game_list.prize_id = 2 And game_list.game_id=2 ; 

but it gave me no good results .

  • 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-26T18:04:44+00:00Added an answer on May 26, 2026 at 6:04 pm

    You had a WHERE clause to limit to the correct ids, but you had no join conditions to relate your tables. Instead of the implicit join syntax you attempted (comma-separated table list), use a explicit JOINs with stated relating columns:

    SELECT
      game_list.*, 
      prize_list.* ,
      sponser_list.* 
    FROM 
      game_list
      JOIN prize_list ON game_list.prize_id = prize_list.prize_id
      JOIN sponser_list ON game_list.sponser_id = sponser_list.sponser_id
    WHERE game_list.sponser_id=2  And  game_list.prize_id = 2 And game_list.game_id=2 ;
    

    I would recommend against selecting all columns from each table though, since you are duplicating the id columns in at least two places. Instead, be explicit about the columns you want. This will also help you if you later add additional columns to these tables that should not be included in this query.

    SELECT
      game_id,
      game_title,
      game_list.sponser_id,
      game_expiration_date,
      game_list.prize_id,
      prize_image_name,
      prize_cost,
      prize_title,
      remaining_quantity,
      prize_description,
      sponser_name    
    FROM 
      game_list
      JOIN prize_list ON game_list.prize_id = prize_list.prize_id
      JOIN sponser_list ON game_list.sponser_id = sponser_list.sponser_id
    WHERE game_list.sponser_id=2  And  game_list.prize_id = 2 And game_list.game_id=2 ;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have a table that looks like this: ProjectID TaskID Date 000 001
I have a schema that looks like this: Tables table_id seat_count Orders order_id table_id
I have two tables in a database that looks like this members table1 id
I have two tables that looks like this: Class Name Score Top 1 Amy
I have a table that looks like this: nid vid tid 1 2 3
I have a table that looks like this: <table> <thead> <!-- random table headings
I have a table that looks like this: |StreetName NR| NR | |Teststreet 34|
I have a table that looks like this: id count 1 100 2 50
I have a table that looks like this for about ~30 students: StudentID Course*
I have a table that looks like this: ╔════╦═════════╦═════════╦═══════╗ ║ id ║ deleted ║

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.