mendoz Posted December 12, 2006 Share Posted December 12, 2006 Hey freaks.So here it goes.I have a site with 5 categories(pcs,laptops...).Normally I would create 5 tables for each category and then use:"[color=green]SELECT * from '$table' WHERE id='$id'[/color]" or something like that.So now I want to use a single table. How I get the correct line of the correct category.For example: Get line number three from all the lines where type=laptop.This can't be to hard for you guys,I hope you're up for the "challange"... :o Quote Link to comment Share on other sites More sharing options...
artacus Posted December 13, 2006 Share Posted December 13, 2006 by line number do you mean field or column?I don't really understand your question. But try some variation of:SELECT manufacturer FROM computers WHERE type = 'laptop' AND os = 'Windows XP Home' Quote Link to comment Share on other sites More sharing options...
mendoz Posted December 13, 2006 Author Share Posted December 13, 2006 I only have 1 table containing different product categories:| product id | category |------------------------| 1 | laptops || 2 | cooling || 3 | pc's || 4 | laptops || 5 | pc's |------------------------I want to get all the laptops and sort them like this: 1,2...So I could use them with loops and stuff.Any idea? Quote Link to comment Share on other sites More sharing options...
mendoz Posted December 14, 2006 Author Share Posted December 14, 2006 Anyone? bump ??? Quote Link to comment Share on other sites More sharing options...
artacus Posted December 14, 2006 Share Posted December 14, 2006 SELECT * FROM whatever WHERE category = 'laptops' ORDER BY product_id Quote Link to comment 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.