• 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]

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]