Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8663957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:07:21+00:00 2026-06-12T17:07:21+00:00

I have a Query: var cams = (from c in db.cameras join s in

  • 0

I have a Query:

    var cams = (from c in db.cameras
                        join s in db.camera_sites on c.camera_site_id equals s.id
                        join o in db.servers on s.server_id equals o.id
                        where (c.enabled == "yes"
                        && s.enabled == "yes"
                        && o.enabled == "yes" 
                        && o.type == "hosted"
                        && o.server_method == "webservices"
                        && c.account_id == accountId)
                        select new EventCamera_Named { Camera = c, SiteName = s.name, ServerName = o.name }).ToList();

The problem is the SiteName that is selected is the same as Camera.name

The sql that is generated is:

    SELECT
    `Filter1`.`id`, 
    `Filter1`.`account_id`, 
    `Filter1`.`camera_site_id`, 
    `Filter1`.`enabled`, 
    `Filter1`.`name`, 
    ...,
    `Filter1`.`name` AS `name1`, 
    `Extent3`.`name` AS `name2`

    FROM (SELECT
    `Extent1`.`id`, 
    `Extent1`.`account_id`, 
    `Extent1`.`camera_site_id`, 
    `Extent1`.`enabled`, 
    `Extent1`.`name`, 
    ..., 
    `Extent2`.`id` AS `id1`, 
    `Extent2`.`account_id` AS `account_id1`, 
    `Extent2`.`server_id`, 
    ...
    FROM `cameras` AS `Extent1` INNER JOIN `camera_sites` AS `Extent2` ON `Extent1`.`camera_site_id` = `Extent2`.`id`
    WHERE ('yes' = `Extent1`.`enabled`) AND ('yes' = `Extent2`.`enabled`)) AS `Filter1` INNER JOIN `servers` AS `Extent3` ON `Filter1`.`server_id` = `Extent3`.`id`
    WHERE ((('yes' = `Extent3`.`enabled`) AND ('hosted' = `Extent3`.`type`)) AND ('webservices' = `Extent3`.`server_method`)) AND (`Filter1`.`account_id` = 39884476)

How can I rewrite my query return the correct values and what is causing it to get confused?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T17:07:23+00:00Added an answer on June 12, 2026 at 5:07 pm

    When I moved the enabled check directly after the db it was referencing the sql it generated was correct.

        var cams = (from c in db.cameras 
                        where c.enabled == "yes"
                        join s in db.camera_sites on c.camera_site_id equals s.id 
                        where s.enabled == "yes"
                        join o in db.servers on s.server_id equals o.id
                        where (o.enabled == "yes" 
                        && o.type == "hosted"
                        && o.server_method == "webservices"
                        && c.account_id == accountId)
                        select new EventCamera_Named { Camera = c, SiteName = s.name, ServerName = o.name }).ToList();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have this Query: var list = (from x in xList join a
I have following query: var result = ( from role in db.Roles join user
I have a query : var list_transaction = from i in Dt.Transactions join c
I have this query var hql = @from Table1 tbl1 left join fetch tbl1.Table2;
I have a query like so. var query = from o in _context.Orders join
I have this query: var list = (from t1 in context1.SomeTable join t2 in
I have the following query var query = from f in _db.Production join g
I have the query: var q = ( from c in db.tblArcadeGamePlays join a
I have this LINQ query: var returnList = from TblItemEntity item in itemList join
I have a LINQ query: var result = from mt in MessageTypes join mtfmt

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.