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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:11:21+00:00 2026-06-08T11:11:21+00:00

I am trying to join three tables in MySQ, but when I do it

  • 0

I am trying to join three tables in MySQ, but when I do it my way, I get duplicate rows with incorrect values. and it appears that I am not doing it correctly.

I have three tables that I need to join:

nt_stentyper
id | tagsten | varenr_tilb | prod_type | dk | no | sv

nt_tunliste
varenummer | tunnummer | beskrivelse 

nt_priser
varenummer | pris

The data I wish to find is grouped by the varenummer in nt_tunliste and nt_priser. That varenummer is taken for varenr_tilb.

I tried this:

SELECT * FROM nt_stentyper 
INNER JOIN nt_tunliste ON nt_stentyper.varenr_tilb = nt_tunliste.varenummer 
INNER JOIN nt_priser ON nt_stentyper.varenr_tilb = nt_tunliste.varenummer 
WHERE nt_stentyper.tagsten = 1 
ORDER BY nt_stentyper.prod_type ASC

… but that gives me duplicate rows like:

ID  tagsten varenr_tilb prod_type   dk  no  sv  varenummer  tunnummer   beskrivelse  varenummer pris_dk
1   1       12345678    1           1   1   1   12345678    12131415    RT 801       11111111   213
1   1       12345678    1           1   1   1   12345678    12131415    RT 801       12345678   200
5   1       11111111    5           1   1   1   11111111    11111112    Gratbånd     11111111   213
5   1       11111111    5           1   1   1   11111111    11111112    Gratbånd     12345678   200

… which isn’t what I want.

The query should only display one varenummer.

  • 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-08T11:11:23+00:00Added an answer on June 8, 2026 at 11:11 am

    the condition on the second join should have something to do with nt_priser, but it’s a duplicate of the first join condition.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a three different tables that I'm trying to join up correctly but
I have three tables that I need to join together and get a combination
I am trying to join three tables together but having a problem getting the
I am trying to join three tables within an update statement, but I have
I'm trying to get an array that contains information from three tables. The result
I have the following three tables. I am trying to inter link (join) among
I am having a problem trying to JOIN across a total of three tables:
I have a MySQL Left Join problem. I have three tables which I'm trying
I have three tables that I'm wondering If I should join, the tables are
I'm trying to update fields from three different tables but I'm getting some errors:

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.