Help on Sql in Access and ASP | Member | | Join Date: Jul 2008
Posts: 123
| |
im have tables in access,Customer,Products and Order Table...
Customer Table: -
Cust_ICNumber (PK)
-
Cust_Name
-
Cust_Address
-
Cust_PrimaryNumber
-
Cust_SecondaryNumber
-
Cust_Company
-
Cust_CompanyType
-
Products Table - Product_ID (PK)
-
Product_Name
-
Product_Price
-
Product_Picture
-
Order Table -
Order_ID(PK)
-
Product_ID(FK)
-
Order_Quantity
-
Order_Date
-
Customer_ICNumber (FK)
-
Total_Price
-
I intend to output bill (a classic asp file) from order table which will display Order ID,Product Name,Product Price, Customer Name,Customer Address,Order Date.
I wondering if this sql is correct and can be used in classic ASP - SELECT tCustomer.Cust_Name,
-
tCustomer.Cust_Address,
-
tProducts.Product_Name,
-
tOrder.Order_Quantity,
-
tOrder.Order_Date,
-
tOrder.Order_ID,
-
tOrder_Total_Price
-
-
FROM (((Order AS tOrder LEFT JOIN
-
Customer AS tCustomer
-
ON tOrder.Customer_ICNumber=tCustomer.Cust_ICNumber) LEFT JOIN
-
Products AS tProducts
-
ON tOrder.Product_ID=tProducts.Product_ID);
because I have been trying to use this code but i keep getting error on this at the FROM clause.
| |
best answer - posted by MikeTheBike | Quote:
Originally Posted by puT3 im have tables in access,Customer,Products and Order Table...
Customer Table: -
Cust_ICNumber (PK)
-
Cust_Name
-
Cust_Address
-
Cust_PrimaryNumber
-
Cust_SecondaryNumber
-
Cust_Company
-
Cust_CompanyType
-
Products Table - Product_ID (PK)
-
Product_Name
-
Product_Price
-
Product_Picture
-
Order Table -
Order_ID(PK)
-
Product_ID(FK)
-
Order_Quantity
-
Order_Date
-
Customer_ICNumber (FK)
-
Total_Price
-
I intend to output bill (a classic asp file) from order table which will display Order ID,Product Name,Product Price, Customer Name,Customer Address,Order Date.
I wondering if this sql is correct and can be used in classic ASP
[CODE}
SELECT tCustomer.Cust_Name, tCustomer.Cust_Address, tProducts.Product_Name,tOrder.Order_Quantity, tOrder.Order_Date,tOrder.Order_ID, tOrder_Total_Price FROM (((Order AS tOrder LEFT JOIN Customer AS tCustomer ON tOrder.Customer_ICNumber = tCustomer.Cust_ICNumber) LEFT JOIN Products AS tProducts ON tOrder.Product_ID = tProducts.Product_ID); [/code]
because I have been trying to use this code but i keep getting error on this at the FROM clause. Hi
I am not too sure about classic ASP, I have not used it at all (in anger) but have two comments on you query
1. Your have, too many opening brackets in the FROM clause (hence the error?)
2. I not sure why you have used alias named for each tables (perhaps this is for ASP!)?
Does that help?
MTB
| | Expert | | Join Date: Jun 2007 Location: Derbyshire, UK
Posts: 347
| | | re: Help on Sql in Access and ASP Quote:
Originally Posted by puT3 im have tables in access,Customer,Products and Order Table...
Customer Table: -
Cust_ICNumber (PK)
-
Cust_Name
-
Cust_Address
-
Cust_PrimaryNumber
-
Cust_SecondaryNumber
-
Cust_Company
-
Cust_CompanyType
-
Products Table - Product_ID (PK)
-
Product_Name
-
Product_Price
-
Product_Picture
-
Order Table -
Order_ID(PK)
-
Product_ID(FK)
-
Order_Quantity
-
Order_Date
-
Customer_ICNumber (FK)
-
Total_Price
-
I intend to output bill (a classic asp file) from order table which will display Order ID,Product Name,Product Price, Customer Name,Customer Address,Order Date.
I wondering if this sql is correct and can be used in classic ASP
[CODE}
SELECT tCustomer.Cust_Name, tCustomer.Cust_Address, tProducts.Product_Name,tOrder.Order_Quantity, tOrder.Order_Date,tOrder.Order_ID, tOrder_Total_Price FROM (((Order AS tOrder LEFT JOIN Customer AS tCustomer ON tOrder.Customer_ICNumber = tCustomer.Cust_ICNumber) LEFT JOIN Products AS tProducts ON tOrder.Product_ID = tProducts.Product_ID); [/code]
because I have been trying to use this code but i keep getting error on this at the FROM clause. Hi
I am not too sure about classic ASP, I have not used it at all (in anger) but have two comments on you query
1. Your have, too many opening brackets in the FROM clause (hence the error?)
2. I not sure why you have used alias named for each tables (perhaps this is for ASP!)?
Does that help?
MTB
|  | Administrator | | Join Date: Oct 2006 Location: London - UK
Posts: 15,765
| | | re: Help on Sql in Access and ASP
PuT3, you've clearly gone to some trouble laying the tables out, which is appreciated. I expect if you'd done the same with the SQL you would have seen the problem yourself very easily (No criticism - just irony - you did a good job overall).
MTB hit the nail on the head (and he even managed it before the reformat - Kudos).
PS. @MTB - Using Aliases is not too unusual. Sometimes simply to see them displayed in a standard format. I use them myself sometimes to shorten the names so making qualifying field references easier.
| | Member | | Join Date: Jul 2008
Posts: 123
| | | re: Help on Sql in Access and ASP
oo..That's mean i should delete the brackets ok...i will try it...thanks...
| | Expert | | Join Date: Jun 2007 Location: Derbyshire, UK
Posts: 347
| | | re: Help on Sql in Access and ASP Quote:
Originally Posted by NeoPa PS. @MTB - Using Aliases is not too unusual. Sometimes simply to see them displayed in a standard format. I use them myself sometimes to shorten the names so making qualifying field references easier. Point taken, even done the latter myself, but in this case, just seemed no make it more complicated (was just a comment) !!
Cheers
MTB
|  | Administrator | | Join Date: Oct 2006 Location: London - UK
Posts: 15,765
| | | re: Help on Sql in Access and ASP Quote:
Originally Posted by puT3 oo..That's mean i should delete the brackets ok...i will try it...thanks... Not exactly. I assume you're referring to the parentheses when you say brackets. What you need is to ensure they're balanced (opens all have matching closes) rather than to remove them completely.
PS. @MTB - I wasn't trying to criticise - just commenting from one expert to another. Sorry if it came across wrongly.
|  | Similar Microsoft Access / VBA bytes | | | Forums
Visit our community forums for general discussions and latest on Bytes
/bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,567 network members.
|