Results 1 to 8 of 8
  1. #1
    Join Date
    Aug 2009
    Posts
    4

    Question Unanswered: mySQL codde to join Cat,SubCat,SubSubCat

    I already have a search field on my website by following a tutorial on Pixeldigest.com. I have also learned the creation of tables and the connection of them in Dreamweaver to mySQL database.
    I will try to explain you the problem on a very simple way.
    I have Customers and I publish they business advertising on my web pages. If someone is searching for a particular word on my page, I want on the Result_Page all customers related to their
    “Category” “Sub-Category” and “Sub-Subcategory”
    Note: Below I wrote the idea
    I do understand Primary Keys, Foreign Keys, Indexing, Table Creation, and Connections but….
    How many tables do I need?
    What field and on which TBL and how to make a relationship?
    Which TBL is Child and which is Parent?
    Where each FK goes?
    How do I write mySQL code in Dreamweaver? SELECT, JOIN, OR, AND, LEFTJOIN, etc.

    This is what I have at this time, but I do not know what to do with it.

    TBL_1 CUSTOMER_NAME & CUSTOMER_IMG (George Sporting Goods) (Banner)
    TBL_2 CATEGORY: (Sports)
    TBL_3 SUB_CATEGORY: (Baseball)
    TBL_4 SUB_SUB_CATEGORY (Baseball Bat)

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    hello george

    have a look at this article --
    Categories and Subcategories

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Aug 2009
    Posts
    4
    Thank you for your prompt response. I will look at the link you sent me.

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by chinalinda
    Thank you for your prompt response. I will look at the link you sent me.
    dear chinalinda

    you should have looked at it yesterday, when i gave it to you after you emailed me the exact same question under the name of George Torres

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  5. #5
    Join Date
    Aug 2009
    Posts
    4
    I was reading the article, but it is to advaced for me at this time. Even I do understand the whole idea I can't do it myself without help. Please could you write for me the code. I mean SELECT tbl, etc,etc..
    Thank you

  6. #6
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by chinalinda
    I was reading the article, but it is to advaced for me at this time. Even I do understand the whole idea I can't do it myself without help. Please could you write for me the code. I mean SELECT tbl, etc,etc..
    Thank you
    give it a try yourself, and i will help if you get stuck

    start by writing the query to display all categories, subcategories, and subsubcategories

    hint: this query is already given to you in that article
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  7. #7
    Join Date
    Aug 2009
    Posts
    4

    Red face mySQL search nightmare

    SELECT customers.customername,categoria2.categoria2,categ oria.categoria
    FROM customers,categoria2,categoria
    WHERE customers.categoria=categoria.categoria

    This is the result

    customername categoria2 categoria
    george angels work Mecanicos de automotores
    smith angels work Mecanicos de automotores
    george bodyshop Mecanicos de automotores
    smith bodyshop Mecanicos de automotores
    george curandero Mecanicos de automotores
    smith curandero Mecanicos de automotores
    george reparacion de carros Mecanicos de automotores
    smith reparacion de carros Mecanicos de automotores

  8. #8
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    that output is from your test database, yes/

    please mysqldump the tables, or Export them if you are using a front-end application like phpmyadmin -- both structure and data, please (i.e. both CREATE TABLE and INSERT statements)
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •