kapil_kk (7/3/2013)
You can use LIKE keyword for this-SELECT dbo.Trnasction.Salesorder, dbo.SalesPerson.SalesPersonName
FROM dbo.Trnasction CROSS JOIN
dbo.SalesPerson
WHERE dbo.SalesPerson.SalesPersonName LIKE 'John%'
Looks good! But...
The above will return every possible transaction for the every sales person named John%, including transaction which has nothing to do with this sales persons.
CROSS JOIN is a bad choice for this sort of thing.
It should be more like:
SELECT dbo.SalesPerson.SalesPersonName, dbo.Trnasction.Salesorder
FROM dbo.SalesPerson
INNER JOIN dbo.Transction ON [Relevant Keys]
WHERE dbo.SalesPerson.SalesPersonName LIKE 'John%'[/quote]