473,396 Members | 2,154 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

need a view with "order by"


I have 2 tables and am displaying data in a single table on a web page
from both tables. Most of the data that I'm displaying is in table 2 but
some is in table 1 (lastname, firstname). I'm using "order by" to allow
sorting table 2 using hyperlinks, but I haven't figured out how to allow
sorting the "view" based on the lastname/firstname from table 1. The 2
tables are linked by a primary key. "Client_id" is a primary key in
table 1 and is a foreign key in table 2.

Is there a way to sort a view of 2 tables? I'd like to be able to sort
on lastnames from table 1 and then have the view show the correct data
from table 2 (get table 2 to display by last name).

thanks,
Jim

Jul 20 '05 #1
2 1585
James Johnson wrote:
Is there a way to sort a view of 2 tables? I'd like to be able to sort
on lastnames from table 1 and then have the view show the correct data
from table 2 (get table 2 to display by last name).


Does this do what you want?

SELECT table2.*
FROM table1 INNER JOIN table2 USING (Client_id)
ORDER BY table1.lastname, table1.firstname

Regards,
Bill K.
Jul 20 '05 #2
On Tue, 04 Jan 2005 12:13:25 -0800, Bill Karwin <bi**@karwin.com> wrote:
James Johnson wrote:
Is there a way to sort a view of 2 tables? I'd like to be able to sort
on lastnames from table 1 and then have the view show the correct data
from table 2 (get table 2 to display by last name).


Does this do what you want?

SELECT table2.*
FROM table1 INNER JOIN table2 USING (Client_id)
ORDER BY table1.lastname, table1.firstname

Regards,
Bill K.


Thanks for your suggestion. That works perfectly.

Jim

Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

23
by: ian justice | last post by:
Before i post actual code, as i need a speedyish reply. Can i first ask if anyone knows off the top of their head, if there is a likely obvious cause to the following problem. For the moment i've...
1
by: Simon Wigzell | last post by:
Is it possible to retrieve data with ASP sorted on 2 fields? I've tried : SELECT * FROM ORDER By Field1 AND Field 2 But it gives an error. I've searched the internet on this topic to no avail....
4
by: Josué Maldonado | last post by:
Hello list, The query has the following in the where: UPPER(cty_Name) LIKE 'NEW%' ORDER BY cty_name it returns the data in this way: Newark Newark
3
by: Ptbrady | last post by:
"Order By" fails in form for linked table. -------------- My A2K database has worked well for several years, but now has been split into front-end/back-end and has the following problem. I have a...
9
by: Frederik | last post by:
Hi all, I'm building a C# application that uses a M$ Acces database. In one of the queries I use something like the following: SELECT id FROM mytable WHERE id IN (20, 12, 21, 14) The result...
8
by: vijay | last post by:
Hello, As the subject suggests, I need to print the string in the reverse order. I made the following program: # include<stdio.h> struct llnode { char *info;
2
by: Richard Hollenbeck | last post by:
I have the following query in a combo box: SELECT courses.courseCode, courses.courseDescription FROM courses ORDER BY courseDescription; I want to change the "ORDER BY" to display in...
3
by: =?Utf-8?B?VmFuZXNzYQ==?= | last post by:
Here is my loop and it runs fine: ---------------------------------------------------- sSQL = "SELECT * FROM STORE_ITEMS" Set DataRec = DB.execute(sSQL) if not DataRec.EOF then do while not...
5
by: Tom_F | last post by:
To comp.databases.ms-access -- I am trying to re-number the "tab index" for a large number of controls on a form. When I try to do this one control at a time, Access automatically re-numbers...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.