OQL query help

Thread is closed for posting
2 posts, 0 answers
  1. Jonathan Simmons
    Jonathan Simmons avatar
    108 posts
    Member since:
    Jun 2005

    Posted 24 Feb 2009 Link to this post

    Hi, I am new to OQL and am having some problems with basic queries in the OQL browser. Perhaps you could help.

    I have a Company table and Contact table with an intermediate table called CompanyContact which just holds the companyID and ContactID. Nothing out of the ordinary.

    When I run the OQL


    SELECT company.companyName, contact.lastName FROM CompanyExtent AS company,   
    company.companyContact as contact where   

    all I get in the OQL results grid is a column labelled 'Content' with the company name list and no contact.lastName. If I run the generated SQL in SQLServer, I get what I would expect, ie the company name repeated with each contact's lastname.

    • Why does the OQL browser results grid display something different?


    • Why does the results grid display one column entitled 'Content' if I run the OQL
    SELECT contact.firstName, contact.lastName FROM CompanyExtent AS company,   
    company.companyContact as contact where   

    or is OQL just too different from TSQL?


  2. Jan Blessenohl
    Jan Blessenohl avatar
    707 posts

    Posted 24 Feb 2009 Link to this post

    Hi Jonathan Simmons,
    Yes, it is different :)

    Oql is object oriented, your query is still relational. You want to have a customer with a specific id that refers to a Contact.

    You can just say select * from CompanyExtent as c where c.companyId == ... This will return real Company objects and you just navigate to the CompanyContact and you will have the contact in memory as well.

    Sincerely yours,
    Jan Blessenohl
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top