Reputation: 195
I have two tables one is 'CUSTOMER' and another is 'ADDRESS' as follows
CUSTOMER(CID,FNAME,LNAME,AID)
ADDRESS(AID,ADDRESS,PHONE,EMAIL,CID)
A customer can have multiple address, I want to select all the customers with all addresses who have 'NAME LIKE' something
I want the result like
CID FNAME LNAME ADDRESS PHONE EMAIL
1 someone1 something1 address1 9876543110 [email protected]
1 someone1 something1 address2 9876543110 [email protected]
2 someone2 something2 address1 9876543110 [email protected]
2 someone2 something2 address2 9876543110 [email protected]
Upvotes: 0
Views: 653
Reputation: 1008
You can use %, it matches any string of zero or more characters. For example
SELECT Phone
FROM Person
WHERE Phone LIKE '415%';
It will give all phone numbers starting with 415.
Upvotes: 3