Jump to content

[SOLVED] Cross table reference in SELECT statement


pofigster

Recommended Posts

I'm using MySQL 5.0

 

I'm wondering if the following is possible:  I have one table which has 100 rows and a primary index called 'percent' - everytime a page is loaded I want to select one of these rows (always in order, so, if last time 'percent'=1 was displayed, this time I want 'percent'=2 to display until 'percent'=100 and then I want 'percent'=1 to display again).  I have another table which has one row and one variable called 'curr_perc'  PHP already sends the command to increment this variable each time a page is loaded, but I don't want to do a query to retrieve this value and then another to select the row in the first table - so, is there some way I can say "SELECT * FROM 'adverts' WHERE percent=adv_current.curr_perc" (where adv_current is the table with one row and one variable)?

 

Maybe my idea can be done some other way?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.