| |
|
If this is your first visit, be sure to check out the FAQ by clicking the link above.
You may have to register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
|
 |

08-06-09, 11:23
|
|
Registered User
|
|
Join Date: Aug 2009
Posts: 4
|
|
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)
|
|

08-06-09, 11:33
|
|
SQL Consultant
|
|
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
|
|
|
|

08-06-09, 13:12
|
|
Registered User
|
|
Join Date: Aug 2009
Posts: 4
|
|
|
|
Thank you for your prompt response. I will look at the link you sent me.
|
|

08-06-09, 13:27
|
|
SQL Consultant
|
|
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
|
|
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

|
|

08-06-09, 14:25
|
|
Registered User
|
|
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
|
|

08-06-09, 14:42
|
|
SQL Consultant
|
|
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
|
|
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
|
|

08-07-09, 20:42
|
|
Registered User
|
|
Join Date: Aug 2009
Posts: 4
|
|
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
|
|

08-07-09, 22:09
|
|
SQL Consultant
|
|
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
|
|
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)
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|