By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,197 Members | 1,210 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,197 IT Pros & Developers. It's quick & easy.

select statement

omerbutt
100+
P: 638
hi i have 2 tables like product and product_files
for each product in the product table i have multipe records for files in the product_files tyable i an usng join here but something is wrong i need to omit the repeated records from the product table as it is repeating the record again and again , i am messed up and cant get what is wrong here is the query
Expand|Select|Wrap|Line Numbers
  1. SELECT  *
  2. FROM (product, product_files) 
  3.  JOIN product_files p ON 
  4. p.product_id=product.id 
  5. WHERE product.id = 1
  6. group by p.product_id
  7.  
it is selecting the single record from the product table but not selecting all records fro the product_files table
regards,
Omer Aslam
Feb 23 '12 #1
Share this Question
Share on Google+
1 Reply


Rabbit
Expert Mod 10K+
P: 12,366
I don't know what you mean. Sample data and results would help to clarify. On a side note, since you're limiting to one id, there's no need for a group by. But also, that query shouldn't run anyways, since you're most likely not grouping by or aggregating on all the fields included in your select.
Feb 23 '12 #2

Post your reply

Sign in to post your reply or Sign up for a free account.