Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

ASP/ADO/SQL question - Any experts?

Thread Tools
 
Search this Thread
 
Old 29 January 2004, 03:45 PM
  #1  
rogp
Scooby Regular
Thread Starter
 
rogp's Avatar
 
Join Date: Mar 2003
Posts: 455
Likes: 0
Received 0 Likes on 0 Posts
Question

Hello,

I have 2 databases, one our client database holding contact details etc and one a database containing details of documents we hold for our clients ('we' are a firm of solicitors)

So, DB1 is client info and DB2 is Doc info. Both are access 97 (yes I know!).

I'm using ASP and ADO to present a nice front end and SQL to access the data.

This is my problem:

DB2 has a table called client info that links to DB1 to avoid replication of data. Another table in DB2 called doc info has a field which does a lookup against a field in the DB2 client info table to obtain client info data.

Code as below:

sql="SELECT PcktID, CLID, Archive_Date, Office_Stored, PrAddr1, EnteredBy, PacketDescription, DeedDescription FROM XXXX"

OK, so CLID is the field looked up by the document table in DB2 which points to the second table in DB2 (client info) which then references DB1 for its data.

My question is:

How do I force my SQL select call to display the field in DB2 client info that I want? By default it picks up the first field (as this is the CLID) but in the database that is just a numerical code, further along the same row will be the actual client name etc that I want to display.

Does that make any sense?

Thanks in advance.

Roger

(learning SQL - can you tell? )

[Edited by rogp - 1/29/2004 3:46:15 PM]

[Edited by rogp - 1/29/2004 3:49:20 PM]
Old 29 January 2004, 07:23 PM
  #2  
Jerome
Scooby Regular
 
Jerome's Avatar
 
Join Date: Sep 2000
Posts: 4,460
Likes: 0
Received 0 Likes on 0 Posts
Post

Not sure if I completely understood you, but I think you want to something like this:

SELECT
DBx.tablename.PcktID,
DBx.tablename.ClientName,
DBx.tablename.Archive_Date,
DBx.tablename.Office_Stored,
DBx.tablename.PrAddr1,
DBx.tablename.EnteredBy,
DBx.tablename.PacketDescription,
DBx.tablename.DeedDescription
FROM DB1,DB2
WHERE DB1.tablename.CLID = DB2.tablename.CLID

Obviously insert the correct database for each "DBx" and the correct table name for each "tablename".

Hope this helps...

[Edited by Jerome - 1/29/2004 7:23:54 PM]
Old 29 January 2004, 08:36 PM
  #3  
rogp
Scooby Regular
Thread Starter
 
rogp's Avatar
 
Join Date: Mar 2003
Posts: 455
Likes: 0
Received 0 Likes on 0 Posts
Post

Thanks, I'll give that a go.

So you can use mutliple tables within a single SELECT command?

Roger
Old 29 January 2004, 09:32 PM
  #4  
GaryK
Scooby Regular
 
GaryK's Avatar
 
Join Date: Sep 1999
Location: Bedfordshire
Posts: 4,037
Likes: 0
Received 0 Likes on 0 Posts
Post

rog,

yes you can just do a search in help for 'joins' be very careful though access is not SQL standard (ANSI92) compliant so what you learn will not carry you thru to SQL Server/Oracle/DB2 but it does support joins and thats what you need to learn up on.

Cheers
\
Gary
Old 29 January 2004, 10:05 PM
  #5  
rogp
Scooby Regular
Thread Starter
 
rogp's Avatar
 
Join Date: Mar 2003
Posts: 455
Likes: 0
Received 0 Likes on 0 Posts
Post

Thanks again to you both.

Roger
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
KAS35RSTI
Subaru
27
04 November 2021 07:12 PM
slimwiltaz
General Technical
20
09 October 2015 07:40 PM
IanG1983
Wheels, Tyres & Brakes
2
06 October 2015 03:08 PM
Brzoza
Engine Management and ECU Remapping
1
02 October 2015 05:26 PM
the shreksta
Other Marques
26
01 October 2015 02:30 PM



Quick Reply: ASP/ADO/SQL question - Any experts?



All times are GMT +1. The time now is 04:34 AM.