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

The Archive Base Latest Questions

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

I’m trying to link two tables in the same database using a third. The

  • 0

I’m trying to link two tables in the same database using a third.

The first table is product and has the productcode. The second table is shop and has the shopcode.
The third table has the shopcode and corresponding productcode.

However not all products are sold and now it just deletes those products at the results.

This shrinks the list from 1600 to 753, however I want to see the list of products and the shops are a secondary issue.

So instead of deleting the entire row i’d like the table to just say that there is no shop selling it by leaving the area grey or stating NULL.

I’ve used:

SELECT * FROM product, sells
WHERE product.productcode = sells.shopcode 
ORDER BY product.productcode.

I’ve tried to find it using google and a few of my friends but I can’t seem to find the answer.

Thanks all of you,
Jell0zz

EDIT: after Tamago’s help i’ve got everything in the right table however on firefox atleast, another problem is that when there is no value instead of leaving the borders of the table it leaves an empty space, this makes it look like there are parts missing. Also, in the first colomn i put the productID, however it seems to only show the productID if it is in the sells as well, otherwise it leaves an empty space as well.

The code:

$sql = 'SELECT * FROM bier LEFT JOIN schenkt ON bier.biercode = schenkt.biercode LEFT JOIN kroeg ON schenkt.kroegcode = kroeg.kroegcode'; $resultaat = $db->query($sql); echo '<table border = 0>'; echo "<tr> <td style = 'width:100%;'>"; echo '<table border = 1>'; foreach($resultaat as $row) { echo '<tr>'; $nummer = $row['bier.biercode']; echo '<td>'.$row['bier.biercode'].'</td>'; echo '<td>'.$row['naam'].'</td>'; echo '<td>'.$row['type'].'</td>'; echo '<td>'.$row['stijl'].'</td>'; echo '<td>'.$row['alcohol'].'</td>'; echo '<td>'.$row['kroegnaam'].'</td>'; echo '<td>'.$row['adres'].'</td>'; echo '<td>'.$row['plaats'].'</td>';

It might be worth noting that t1=bier (or beer in english) t2=schenkt (or sells) and t3=kroeg (or bar)

Disclaimer, I’m not an alcoholic but I think my teacher might be 😉

  • 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:24:43+00:00Added an answer on June 6, 2026 at 12:24 am
    SELECT * FROM Products t1
    
    LEFT JOIN myBridgeTable t2
    ON t1.ProductID = t2.ProductID
    
    LEFT JOIN Shops t3
    ON t2.ShopID = t3.ShopID
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I'm making a simple page using Google Maps API 3. My first. One marker
I am trying to understand how to use SyndicationItem to display feed which is
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function

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.