CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> Archive -> CodeCharge.Discussion

 sql statement??

Print topic Send  topic

Author Message
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()
>
>


   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.