Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
Need help with Select Statement
Old 04-24-2006, 03:02 PM Need help with Select Statement
barbara's Avatar
Skilled Talker

Posts: 79
Trades: 0
this is an ACCESS sql statement from my ACCESS database query:

SELECT tblCustomers.*, tblTestOrder.*, tblAbrasions.*, tblAppliedDecoration.*
FROM ((tblCustomers INNER JOIN tblTestOrder ON tblCustomers.CustID = tblTestOrder.CustomerID) INNER JOIN tblAbrasions ON tblTestOrder.TestOrderID = tblAbrasions.TestID) INNER JOIN tblAppliedDecoration ON tblTestOrder.TestOrderID = tblAppliedDecoration.ADTestID;

how can i change it to an ASP SELECT statement?

thanks
barbara is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 04-24-2006, 06:03 PM Re: Need help with Select Statement
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
wrap it in quotes and add strSQL = before it


or do you mean you want to concatenate it using variables or submitted values?

if so which values would be replaced by variables

or is the whole ADO database and recordset calls you need to know?
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 04-26-2006, 12:41 PM Re: Need help with Select Statement
barbara's Avatar
Skilled Talker

Posts: 79
Trades: 0
thanks. it works. here's my new sql statement:

sql="SELECT tblCustomers.*, tblTestOrder.*, tblAbrasions.* FROM ((tblCustomers INNER JOIN tblTestOrder ON tblCustomers.CustID = tblTestOrder.CustomerID) INNER JOIN tblAbrasions ON tblTestOrder.TestOrderID = tblAbrasions.TestID) WHERE TestRequestNo= '" &PO& "'"

are there limitations as to how many table i can put in the Select statement? the reason for asking this question is that tblCustomers contains only the customer information. tblTestOrder contains the date required, date submit, which test to perform (16 different tests), etc. Each test result is store in its own table with testid as a foreign key to the test result table.

a customer can request multiple tests to be perform. the select statement above only retreive the test result from tblAbrasions; how can i add the rest of the other test results from the other tables?

Also can i use the same variable name in each different table?

many thanks
barbara is offline
Reply With Quote
View Public Profile
 
Old 04-26-2006, 12:44 PM Re: Need help with Select Statement
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,938
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Trades: 0
Is TestRequestNo a string or a number? If it's a number, you're enclosing it in quotes which may be causing your problem.

Also, it's better from a performance standpoint to only include the fields you'll actually want to retrieve in your output from an ADO query.

e.g. SELECT tblCustomers.Field_1, tblCustomers.Field_2, tblAbrasions.Field_1, tblAbrasions.Field_2, etc.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
(my blog)


Please login or register to view this content. Registration is FREE
(with proof)
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Reply     « Reply to Need help with Select Statement
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.62618 seconds with 12 queries