• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Price database and confusing SQL query

#1
[eluser]MarcL[/eluser]
Hello.

I've been coding up a product database which takes a number of XML feeds and records the prices of the products over time. I'd like to be able to monitor the price of say an iPod and see what the best price is at a number of different retailers on a given day.

I'm pretty new to MySQL so I'd like some help on whether I'm representing my data correctly in the database tables and how to form the correct SQL query (using ActiveRecord but the whole query is fine too).

So my data is in this format:

product
- id
- name
- description
- etc

merchant
- id
- name
- description
- etc

prices
- id
- price
- product_id
- merchant_id
- created_on (DATETIME that this price was added to the database)

Have I represented my data in the prices table correctly or have I made it difficult for myself?! Smile

The query I'd like is something to get the latest prices from all merchants for a given product id.

Thanks in advance for any help.

Cheers,
Marc


Messages In This Thread
Price database and confusing SQL query - by El Forum - 02-17-2009, 05:13 AM
Price database and confusing SQL query - by El Forum - 02-17-2009, 05:55 AM
Price database and confusing SQL query - by El Forum - 02-17-2009, 06:04 AM
Price database and confusing SQL query - by El Forum - 02-17-2009, 06:43 AM
Price database and confusing SQL query - by El Forum - 02-17-2009, 07:39 AM
Price database and confusing SQL query - by El Forum - 02-17-2009, 10:00 AM
Price database and confusing SQL query - by El Forum - 02-17-2009, 01:39 PM
Price database and confusing SQL query - by El Forum - 02-17-2009, 03:06 PM
Price database and confusing SQL query - by El Forum - 02-17-2009, 03:18 PM
Price database and confusing SQL query - by El Forum - 02-17-2009, 03:40 PM
Price database and confusing SQL query - by El Forum - 02-17-2009, 11:14 PM
Price database and confusing SQL query - by El Forum - 02-18-2009, 03:10 AM
Price database and confusing SQL query - by El Forum - 02-18-2009, 06:59 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.