dan_small Posted August 6, 2003 Share Posted August 6, 2003 hi there, i have a database of news stories about my company. i want to put the stories into catagories so a user can click a button and get stories related to say, products. some stories go in more than one catagory so for normalization i have three tables. 1. the text of the story 2. a list of possible catagories 3. a reference linking the story to the catagory this works fine but i also want users to be able to search for two catagories at once ie. products and web design. if a story is in both these catagories it gets returned twice as the sql finds a reference linking it to one catagory then a reference linking it to the other. I can sort it out so both aren\'t printed on the page but it messes up my number of items found and hence my pagination. is there a better way of setting up my db or any sql that can sort this , or do i have to code around it? Quote Link to comment https://forums.phpfreaks.com/topic/840-same-record-diff-catagories-problem/ Share on other sites More sharing options...
DylanBlitz Posted August 6, 2003 Share Posted August 6, 2003 you should be able to keep it that way, just when you do your select do something like: SELECT distinct news_id from tables distinct will give you only 1 result for each one. Quote Link to comment https://forums.phpfreaks.com/topic/840-same-record-diff-catagories-problem/#findComment-2795 Share on other sites More sharing options...
dan_small Posted August 7, 2003 Author Share Posted August 7, 2003 You see i knew there would be something like that! DylanBlitz you are a fine human being. Thankyou Quote Link to comment https://forums.phpfreaks.com/topic/840-same-record-diff-catagories-problem/#findComment-2806 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.