Curtis Cole
|
| Posted: 08/03/2001, 10:04 AM |
|
how can i order my records? i can't make a database change.
i have two tables in access 2000. The table called cars has these fields:
id, car, discription
the other table called topcars has these fields:
id, date, topcar1, topcar2, topcar3
everyday a diffent car is featured so car1, car2, car3 as an id in it from
cars.
i get todays featured cars by selecting the date from [topcars.date]
and where [topcars.topcar1] = [cars.id],or [topcars.topcar2] = [cars.id],
or [topcars.topcar3] = [cars.id]
how do i make sure topcar1 is first, topcar2 is second, topcar3 is third.
selelect cars.*, topcars.*
where topcars.topcar1 = cars.id,
or cars.topcars.topcar2 = cars.id,
or topcars.topcar3 = cars.id
and topcars.date = date()
|
|
|
 |
Nick Nolte
|
| Posted: 08/03/2001, 12:04 PM |
|
Curtis,
your approach should be changed as following
your topcars table should have only three fields: id, date, ranking
ranking can contain entries from 1 to 3 (or how many topcars you have per
day)
the resulting select statement is very easy:
selelect cars.*, topcars.*
where topcars.date = date()
order by ranking
This table layout results from relation database theory by using
normalization. One benefit is that you can have more than 3 topcars per day.
"Curtis Cole" <ccole@zebra.net> schrieb im Newsbeitrag
news:9keli3$ic$1@news.codecharge.com...
> how can i order my records? i can't make a database change.
>
> i have two tables in access 2000. The table called cars has these fields:
> id, car, discription
> the other table called topcars has these fields:
> id, date, topcar1, topcar2, topcar3
> everyday a diffent car is featured so car1, car2, car3 as an id in it from
> cars.
>
> i get todays featured cars by selecting the date from [topcars.date]
> and where [topcars.topcar1] = [cars.id],or [topcars.topcar2] = [cars.id],
> or [topcars.topcar3] = [cars.id]
>
> how do i make sure topcar1 is first, topcar2 is second, topcar3 is third.
>
> selelect cars.*, topcars.*
> where topcars.topcar1 = cars.id,
> or cars.topcars.topcar2 = cars.id,
> or topcars.topcar3 = cars.id
> and topcars.date = date()
>
>
|
|
|
 |
|