Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



Reply
Need help to categorise the data
Old 09-06-2010, 03:33 PM Need help to categorise the data
Experienced Talker

Posts: 33
Trades: 0
Hello Friends,

I created a MySQL database containing data as,

product_id with data - 1200, 1201, 1202.....
product_name with data - product1, product2, product3......
all_category_id(varchar75) with data - (3, 2), (1, 15, 2), (3, 7, 9) ....(two or more category id as varchar. since, many products have more than one category)

Every category ID has a name e.g
1 - arts
2 - entertainment
3 - Games
15 - movies

I'm trying to pull the product list category wise e.g.
select * from tablename where category=1(that is arts)

I used "regexp" but not working perfectly, e.g.
when i say,
select * from tablename where field regexp '.1.';

it returns, products from arts and also movies category as it contains "1" in its ID "15" But I want the list of only arts

So can anyone suggest me solution to get the desired result? I don't want to change the database structure

Thankx in Advance
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

max196 is offline
Reply With Quote
View Public Profile Visit max196's homepage!
 
 
Register now for full access!
Old 09-06-2010, 05:55 PM Re: Need help to categorise the data
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,505
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Quote:
I don't want to change the database structure
Hard luck! Because that's what you HAVE to do.


Create a CORRECT AND SUITABLE data structure rather than messing about with coding "tricks" to make it work!!
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to Need help to categorise the data
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.19553 seconds with 12 queries