Need help with a sql view

Posted on 2012-08-16
Last Modified: 2012-08-20
I am using the following query:

SELECT        a.pkNewTargetID, a.ProductClass, a.Product_ProductServiceName
FROM            Target AS a LEFT OUTER JOIN
                         TargetReference AS b ON a.Product_ProductServiceName = b.ProductServiceName amd b.fk_PlanID='30'
WHERE        (b.ProductServiceName IS NULL) AND (a.Letter = 'Y')

This query is intended to show all records from target that are not in TargetReference that are assigned to that paticular fk_PlanID.  I can get the query to work in design view however when I put it into a view I cannot populate that '30' using a linqdatasource. Please help.
Question by:mwhodges
    LVL 65

    Expert Comment

    by:Jim Horn
    >b.ProductServiceName amd b.fk_PlanID='30'
    typo, amd should be AND

    should this be a.fk_PlanID?

    Author Comment

    Yes sorry.  I made the correction after I posted.
    LVL 30

    Accepted Solution

    I take it the issue here is really about figuring out how to filter when using a LinqDataSource. In general, you can filter the returned data to retrieve only the records that meet particular criteria by setting the LinqDataSource's Where property to the conditions that must be met for a record to be included in the returned data.

    You can do this by parameterising the Where clause (to pick up values from controls automatially as shown under the "Creating a Parameterized Where Clause" section on this page If you want to do it programmatically... then see if this article helps:

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Performance is the key factor for any successful data integration project, knowing the type of transformation that you’re using is the first step on optimizing the SSIS flow performance, by utilizing the correct transformation or the design alternat…
    Introduction In my previous article ( I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
    Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
    Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now