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
 Other Forums
 MS Access
 please help

Author  Topic 

bibiqna_91
Starting Member

3 Posts

Posted - 2011-04-04 : 14:57:48
I use this code but i need the information in alphabetical order.
Could you please tell me where to put the ORDER BY mem_name?

SELECT members.mem_name, roles.role_name
FROM roles
INNER JOIN members
ON roles.mem_no=members.mem_no
WHERE roles.level LIKE "national" OR roles.level LIKE "regional";

Many thanks in advance :)

robvolk
Most Valuable Yak

15732 Posts

Posted - 2011-04-04 : 15:00:02
SELECT members.mem_name, roles.role_name
FROM roles
INNER JOIN members
ON roles.mem_no=members.mem_no
WHERE roles.level LIKE "national" OR roles.level LIKE "regional";
ORDER BY members.mem_name
Go to Top of Page

bibiqna_91
Starting Member

3 Posts

Posted - 2011-04-05 : 07:14:30
thank you :)
Go to Top of Page

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2011-04-05 : 10:46:53
or to be more accurate


SELECT members.mem_name, roles.role_name
FROM roles
INNER JOIN members
ON roles.mem_no=members.mem_no
WHERE roles.level LIKE "national" OR roles.level LIKE "regional"
ORDER BY members.mem_name

Note that you have no % after the variables in the LIKE clauses (i.e. national% and regional%)
this will prevent you getting variations of these names...which is the main benefit of using the LIKE clause
Go to Top of Page

bibiqna_91
Starting Member

3 Posts

Posted - 2011-04-08 : 21:17:27
Ye i got it :) Thank you :)
Go to Top of Page
   

- Advertisement -