1.10.1 Example: Retrieve customers who purchased products
Retrieve from the sales history table (SALESLIST) and customer table (USERSLIST) the customer ID (USERID) and name (NAME) of customers who purchased products on September 5, 2011.
- Table to search
- Specification example
-
SELECT DISTINCT "SALESLIST"."USERID","NAME" FROM "SALESLIST","USERSLIST" WHERE "PUR-DATE"=DATE'2011-09-05' AND "SALESLIST"."USERID"="USERSLIST"."USERID"
- Retrieval results
- Note
-
If you do not specify SELECT DISTINCT, the retrieval results are as follows.
Specification example
SELECT "SALESLIST"."USERID","NAME" FROM "SALESLIST","USERSLIST" WHERE "PUR-DATE"=DATE'2011-09-05' AND "SALESLIST"."USERID"="USERSLIST"."USERID"
Retrieval results