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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:58:38+00:00 2026-06-13T22:58:38+00:00

I have this example tables: table ORDERS client orderno cant1 code1 notes1 cant2 code2

  • 0

I have this example tables:

table ORDERS

client   orderno   cant1   code1   notes1   cant2   code2   notes2   cant[i]   code[i] [...]
--------------------------------------------------------------------------------------
1          1        3      AA01    Test      4      BB01    Testing
2          2        10     XX05    Test      



table PRODUCTS

code   prod    price
---------------------
AA01   Engine   100  
BB01   Wheel     50  



table CLIENTS

client   name      address     telephone
-----------------------------------------
  1     Maxwell   24 1st st    0987654321
  2     Hammer    77 main st   1234567890

I need to relate them to get the quantity, name of the product and price for each of the product lines (they are 30 cant[i], code[i] and notes[i]) and the customer’s information (name, address, etc)

I found this case, but I don’t understand how to apply it to mine: SQL query two tables with relation one-to-many

I hope it’s not too complex.

Thanks in advance!

EDIT

Thanks to ElectricLlama I realized the problem here is the table where the order is storaged. According to his answer, the normalization of the database would improve the way I’m able to get the info.

For anyone interested in this solution, I found this great website: http://www.devshed.com/c/a/MySQL/An-Introduction-to-Database-Normalization/

This SO answer clears it ALL! Super clear and understandable!
https://stackoverflow.com/a/1258776/888292

  • 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-13T22:58:39+00:00Added an answer on June 13, 2026 at 10:58 pm

    Looking at what’s in your link – yes it seems like a lot of nonsense, but it is probably the only way to get what you want.

    The problem is that your table is not normalised. Specifically you should not have fields called code1 code2 code3 code4… code30

    There are many flaws with this design including what happens when a client has 31 products?

    In a normalised database you would have a table with one set of cant, code and notes, and you would have one row per product.

    But I guess you are not in a position to normalise it.

    So well done for coming up with your own answer, and you now you also have first hand experience of the repercussions of not normalising a database.

    What you might want to consider is creating a view that will normalise this for you. It will introduce performance issues but it will give you an introduction to views, and give you an opportunity to see how the solution would look like against a normalised table.

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

Sidebar

Related Questions

In this example we have 3 related tables on a SQLite database: CREATE TABLE
Please give me some examples of jump table usage. I have seen this example
Rails noob here. I have a rails application with (in this example) three tables.
For example, I have this code: <table> <tr> <td class=last></td> <td></td> </tr> <tr> <td
For example I have a table MyTable like this: Id Value Rate 1 10
I have three tables, Products(ProductID, ProductName) Orders(OrderID, OrderDate) OrderDetails(ProductID, OrderID) Junction table between Products
I have this example FactoryGirl.define do @site = FactoryGirl.create(:my_site) factory :user do email {
I have this example: public class Inheritance { public static class Animal { public
Suppose we have this example: http://techdroid.kbeanie.com/2009/07/custom-listview-for-android.html with source code available here: http://code.google.com/p/myandroidwidgets/source/browse/trunk/Phonebook/src/com/abeanie/ How can
jquery.ui.position is not taking the margin values when positioning items? I have this example,

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.