beginner81
Programmer
CUSTOMER
CustomerID CustomerName Address
-----------------------------------------
Cust001 John AAA
Cust002 Smith BBB
Cust003 Alan CCC
PRODUCT
ProductID Items CustomerID
--------------------------------------------
Prod001 Shampoo Cust001
Prod002 Pencil Cust001
Prod003 Eraser Cust001
Prod004 Orange Cust002
Prod005 Apple Cust002
Prod006 PineApple Cust003
The data above is 2 tables in the sql server with corresponding field... (CUSTOMER and PRODUCT TABLE)..
So can i know what is the sql statement for determined how many items that Cust001 purchase??
Sql.Add( ........... where ....... ) ?? and how bout if i want to get last record for certain field
from the table (Cos sometimes i need to get the value from last record to do some parsing)..
so in this case, i would like to get the CustomerID who purchase the last items in the table ??
P/S : assume the last items can b any items.. so all i want is just to what is the last record/value
for CuotomerID field in PRODUCT table..
CustomerID CustomerName Address
-----------------------------------------
Cust001 John AAA
Cust002 Smith BBB
Cust003 Alan CCC
PRODUCT
ProductID Items CustomerID
--------------------------------------------
Prod001 Shampoo Cust001
Prod002 Pencil Cust001
Prod003 Eraser Cust001
Prod004 Orange Cust002
Prod005 Apple Cust002
Prod006 PineApple Cust003
The data above is 2 tables in the sql server with corresponding field... (CUSTOMER and PRODUCT TABLE)..
So can i know what is the sql statement for determined how many items that Cust001 purchase??
Sql.Add( ........... where ....... ) ?? and how bout if i want to get last record for certain field
from the table (Cos sometimes i need to get the value from last record to do some parsing)..
so in this case, i would like to get the CustomerID who purchase the last items in the table ??
P/S : assume the last items can b any items.. so all i want is just to what is the last record/value
for CuotomerID field in PRODUCT table..