Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SQL query help

Author  Topic 

manutd
Starting Member

3 Posts

Posted - 2008-02-21 : 16:29:17
Hi i have a database in place and need help with the following queries

to list the car registration number,milage and service date for cars with a service due in march in alphabetical order of owner name

megbot
Starting Member

17 Posts

Posted - 2008-02-21 : 16:37:25
can you post the structure of the table/tables you're selecting from?
Go to Top of Page

manutd
Starting Member

3 Posts

Posted - 2008-02-21 : 16:49:42
name|address|number plate|car make|milage|servie test date|
Go to Top of Page

megbot
Starting Member

17 Posts

Posted - 2008-02-21 : 16:59:55
select name, number_plate, mileage, service_test_date from table where service_test_date between 03/01/2008 and 03/31/2008 order by name

I assume you'd want to see the name, as your sorting by the name, which is why its included in the select. If not, just omit it.

I'm also unsure how your date column is formatted, if it is at all. if its just text, then do where service_test_date=march
Go to Top of Page
   

- Advertisement -