Search Results

Search found 6841 results on 274 pages for 'outer join'.

Page 3/274 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • 3 SQL Join Concepts to Help You Choose the Right Join

    What do SQL joins and the "teach a man to fish" Chinese proverb have in common? SQL joins, like regular expressions, are one of those commonplace programming tasks in which true success is entirely dependent upon your ability to conceptualize the outcome. Fail to do so and you'll likely wind up spending a few hours in a frustrating round of trial and error. Like regular expressions, the proliferation of online examples has actually contributed to the frustration, providing the equivalent of a day's worth of fish rather than the proverbial fishing pool. The Future of SQL Server MonitoringMonitor wherever, whenever with Red Gate's SQL Monitor. See it live in action now.

    Read the article

  • Duplicate Items Using Join in NHibernate Map

    - by Colin Bowern
    I am trying to retrieve the individual detail rows without having to create an object for the parent. I have a map which joins a parent table with the detail to achieve this: Table("UdfTemplate"); Id(x => x.Id, "Template_Id"); Map(x => x.FieldCode, "Field_Code"); Map(x => x.ClientId, "Client_Id"); Join("UdfFields", join => { join.KeyColumn("Template_Id"); join.Map(x => x.Name, "COLUMN_NAME"); join.Map(x => x.Label, "DISPLAY_NAME"); join.Map(x => x.IsRequired, "MANDATORY_FLAG") .CustomType<YesNoType>(); join.Map(x => x.MaxLength, "DATA_LENGTH"); join.Map(x => x.Scale, "DATA_SCALE"); join.Map(x => x.Precision, "DATA_PRECISION"); join.Map(x => x.MinValue, "MIN_VALUE"); join.Map(x => x.MaxValue, "MAX_VALUE"); }); When I run the query in NH using: Session.CreateCriteria(typeof(UserDefinedField)) .Add(Restrictions.Eq("FieldCode", code)).List<UserDefinedField>(); I get back the first row three times as opposed to the three individual rows it should return. Looking at the SQL trace in NH Profiler the query appears to be correct. The problem feels like it is in the mapping but I am unsure how to troubleshoot that process. I am about to turn on logging to see what I can find but I thought I would post here in case someone with experience mapping joins knows where I am going wrong.

    Read the article

  • Would shell command join cause out of memory?

    - by Hancy
    I have two file to join. FILE 1: a A1 a A2 a A3 ... c C1 c C2 ... FILE 2: a feature1_of_a a feature2_of_a ... a featureN_of_a ... ... c feature1_of_c c feature2_of_c ... after join, i could get File like this: A1 feature1_of_a A2 feature1_of_a A3 feature1_of_a A1 feature2_of_a A2 feature2_of_a A3 feature2_of_a ... A1 featureN_of_a A2 featureN_of_a A3 featureN_of_a ... In order to do that: i wrote shell command join -11 -21 -o1.2,2.2 file1 file2. But the problem is: number N might be huge. So if join read all feautre of a into memory at once, memory might not be enough. I don't know how join is implemented. WQould the momery become a problem? If so, is there any way to get what I want?

    Read the article

  • Left outer join null using VB.NET and LINQ

    - by jvcoach23
    I've got what I think is a working left outer join LINQ query, but I'm having problems with the select because of null values in the right hand side of the join. Here is what I have so far Dim Os = From e In oExcel Group Join c In oClassIndexS On c.tClassCode Equals Mid(e.ClassCode, 1, 4) Into right1 = Group _ From c In right1.DefaultIfEmpty I want to return all of e and one column from c called tClassCode. I was wondering what the syntax would be. As you can see, I'm using VB.NET. Update... Here is the query doing join where I get the error: _message = "Object reference not set to an instance of an object." Dim Os = From e In oExcel Group Join c In oClassIndexS On c.tClassCode Equals Mid(e.ClassCode, 1, 4) Into right1 = Group _ From c In right1.DefaultIfEmpty Select e, c.tClassCode If I remove the c.tClassCode from the select, the query runs without error. So I thought perhaps I needed to do a select new, but I don't think I was doing that correctly either.

    Read the article

  • SQL SERVER – Challenge – Puzzle – Why does RIGHT JOIN Exists

    - by pinaldave
    I had interesting conversation with the attendees of the my SQL Server Performance Tuning course. I was asked if LEFT JOIN can do the same task as RIGHT JOIN by reserving the order of the tables in join, why does RIGHT JOIN exists? The definitions are as following: Left Join – select all the records from the LEFT table and then pick up any matching records from the RIGHT table   Right Join – select all the records from the RIGHT table and then pick up any matching records from the LEFT table Most of us read from LEFT to RIGHT so we are using LEFT join. Do you have any explaination why RIGHT JOIN exists or can you come up with example, where RIGHT JOIN is absolutely required and the task can not be achieved with LEFT JOIN. Other Puzzles: SQL SERVER – Puzzle – Challenge – Error While Converting Money to Decimal SQL SERVER – Challenge – Puzzle – Usage of FAST Hint Reference: Pinal Dave (http://blog.sqlauthority.com) Filed under: Pinal Dave, SQL, SQL Authority, SQL Puzzle, SQL Query, SQL Scripts, SQL Server, SQL Tips and Tricks, T SQL, Technology

    Read the article

  • Left Outer Join - SQL2005

    - by Dan beadle
    I thought I knew enough SQL, but I am having problem with a left outer join. I have an expense detail record that needs to link to a table by dept and account_code. The query looks something like this: select Detail.Spend, Budget.BudgetAmt from detail left outer join budget on detail.dept = budget.dept AND dept.account_code = budget.account_code This works great as long as there is a record that exactly matches the join conditions. But sometimes, there is no matching budget item. I want to get back the Detail.Spend from the details table with nulls for the budgetAmt. Instead, I don't get this record at all. Isn't Left Outer Join supposed to return the left (detail) table when there is no match? Is there something different when multiple criteria are used as I do here? Thanks

    Read the article

  • mysql join with conditional

    - by Conor H
    Hi There, I am currently working on a MySQL query that contains a table: TBL:lesson_fee -fee_type_id (PRI) -lesson_type_id (PRI) -lesson_fee_amount this table contains the fees for a particular 'lesson type' and there are different 'fee names' (fee_type). Which means that there can be many entries in this table for one 'lesson type' In my query I am joining this table onto the rest of the query via the 'lesson_type' table using: lesson_fee INNER JOIN (other joins here) ON lesson_fee.lesson_type_id = lesson_type.lesson_type_id The problem with this is that it is currently returning duplicate data in the result. 1 row for every duplicate entry in the 'lesson fee' table. I am also joining the 'fee type' table using this 'fee_type_id' Is there a way of telling MySQL to say "Join the lesson_fee table rows that have lesson_fee.lesson_type_id and fee_type_id = client.fee_type_id". UPDATE: Query: SELECT lesson_booking.lesson_booking_id,lesson_fee.lesson_fee_amount FROM fee_type INNER JOIN (lesson_fee INNER JOIN (color_code INNER JOIN (employee INNER JOIN (horse_owned INNER JOIN (lesson_type INNER JOIN (timetable INNER JOIN (lesson_booking INNER JOIN CLIENT ON client.client_id = lesson_booking.client_id) ON lesson_booking.timetable_id = timetable.timetable_id) ON lesson_type.lesson_type_id = timetable.lesson_type_id) ON horse_owned.horse_owned_id = lesson_booking.horse_owned_id) ON employee.employee_id = timetable.employee_id) ON employee.color_code_id = color_code.color_code_id) ON lesson_fee.lesson_type_id = lesson_type.lesson_type_id) ON lesson_fee.fee_type_id = client.fee_type_id WHERE booking_date = '2010-04-06' ORDER BY lesson_booking_id ASC How do I keep the format(indentation) of my query?

    Read the article

  • In SQL, can we always write an inner join statement as a main query and subquery if we only want to

    - by Jian Lin
    In SQL, can we always write an inner join statement as a main query and subquery or vice versa if we only want to find the intersection? For example, select * from gifts g where g.giftID in (select giftID from sentGifts); can do a join and show the gifts sent in the sentGifts table, but it won't be able to show the sentTime because that is inside the subquery. But if all we care is to find the intersection, without caring what is being displayed, then we can always convert one to the other?

    Read the article

  • MySQL - Limit a left join to the first date-time that occurs?

    - by John M
    Simplified table structure (the tables can't be merged at this time): TableA: dts_received (datetime) dts_completed (datetime) task_a (varchar) TableB: dts_started (datetime) task_b (varchar) What I would like to do is determine how long a task took to complete. The join parameter would be something like ON task_a = task_b AND dts_completed < dts_started The issue is that there may be multiple date-times that occur after the dts_completed. How do I create a join that only returns the first tableB-datetime that occurs after the tableA-datetime?

    Read the article

  • Linq to Entities and outer joins issue

    - by Robert Koritnik
    Can somebody tell me, why does Linq to Entities translate many to 1 relationships to left outer joins instead of inner joins? It relation was many to 0..1. There's referential constraint on DB itself, that ensures there's a record in the right table, so inner join should be used instead. Is it possible to write LINQ in a way so they will translate to inner joins rather than left outer joins. It would speed query execution a lot.

    Read the article

  • C# Outer Apply in LINQ

    - by JeremySpouken
    How can I achieve Outer Apply in LINQ? I'm having a bit of a problem. Here's the SQL Query I'm using. SELECT u.masterID ,u.user ,h.created FROM dbo.Users u OUTER APPLY (SELECT TOP 1 * FROM UserHistory h where h.masterID = u.masterID ORDER BY created DESC) h

    Read the article

  • LEFT OUTER JOIN with a WHERE clause

    - by Wesley
    I have two tables. indRailType contains a list of the names paired with an ID value that I use in other tables to indicate the rail type. WO_BreakerRail contains a date column and a rail code colume that corresponds to the same code in indRailType and some other data. There's a row in WO_BreakerRail for any activity on each rail type, for every date. So I could have 3 rows dated for 3/19/2010, each row indicates a different rail code, and what happened. When I use the following LEFT OUTER JOIN, I get a table with all the types of rail, with nulls in the rows where nothing happened on the 19th. Now, this is only working because I only have one date represented in my WO_BreakerRail table right now, the 19th. When I add more rows with different dates, things will go haywire. This is my SQL statement, which right now gives me exactly the results I want: SELECT WO_BreakerRail.ID, indRailType.RailType, WO_BreakerRail.CreatedPieces, WO_BreakerRail.OutsideSource, WO_BreakerRail.Charged, WO_BreakerRail.Rejected, WO_BreakerRail.RejectedToCrop FROM indRailType LEFT OUTER JOIN WO_BreakerRail ON indRailType.RailCode = WO_BreakerRail.RailCode Now, when I add in a WHERE WO_BreakerRail.Date = @Date clause I lose all the rows in the JOIN which nothing happened. I don't want that. From reading up, it sounds like a FULL OUTER JOIN is what I want, but SQL Server Compact Edition doesn't support FULL OUTER JOINs. Is there a way around this, or am I looking for something else entirely?

    Read the article

  • Using SQL to join spreadsheets in excel

    - by toms
    Based on the explenation here: How do I join two worksheets in Excel as I would in SQL? I tried to join to excel sheets from different files into the same sheet. However, I keep getting this error message when I try to refresh the table: [MICROSOFT][OBDC Excel Driver] Too few parameters. Expected 5. The SQL queries i've put in so far were: SELECT `Sheet1$`.ID, `Sheet1$`.Name, `Sheet1$`.`L Name` FROM `C:\Users\Tom\Book1.xlsx`.`Sheet1$` a LEFT JOIN `C:\Users\Tom\Book2.xlsx`.`Sheet1$` b ON a.col2= b.col2 and SELECT `Sheet1$`.ID, `Sheet1$`.Name, `Sheet1$`.`L Name` FROM `C:\Users\Tom\Book1.xlsx`.`Sheet1$` a LEFT JOIN `C:\Users\Tom\Book2.xlsx`.`Sheet1$` b ON a.`ID`= b.`ID` and SELECT * FROM `C:\Users\Tom\Book1.xlsx`.`Sheet1$` a LEFT JOIN `C:\Users\Tom\Book2.xlsx`.`Sheet1$` b ON a.`ID`= b.`ID` and a few combinations and alterations. I can't seem to find the solution. I've learned that it definitely doesn't like the SELECT *. But I can't fix it. Can anyone suggest any solution?

    Read the article

  • MySQL LEFT OUTER JOIN virtual table

    - by user1707323
    I am working on a pretty complicated query let me try to explain it to you. Here is the tables that I have in my MySQL database: students Table --- `students` --- student_id first_name last_name current_status status_change_date ------------ ------------ ----------- ---------------- -------------------- 1 John Doe Active NULL 2 Jane Doe Retread 2012-02-01 students_have_courses Table --- `students_have_courses` --- students_student_id courses_course_id s_date e_date int_date --------------------- ------------------- ---------- ---------- ----------- 1 1 2012-01-01 2012-01-04 2012-01-05 1 2 2012-01-05 NULL NULL 2 1 2012-01-10 2012-01-11 NULL students_have_optional_courses Table --- `students_have_optional_courses` --- students_student_id optional_courses_opcourse_id s_date e_date --------------------- ------------------------------ ---------- ---------- 1 1 2012-01-02 2012-01-03 1 1 2012-01-06 NULL 1 5 2012-01-07 NULL Here is my query so far SELECT `students_and_courses`.student_id, `students_and_courses`.first_name, `students_and_courses`.last_name, `students_and_courses`.courses_course_id, `students_and_courses`.s_date, `students_and_courses`.e_date, `students_and_courses`.int_date, `students_have_optional_courses`.optional_courses_opcourse_id, `students_have_optional_courses`.s_date, `students_have_optional_courses`.e_date FROM ( SELECT `c_s_a_s`.student_id, `c_s_a_s`.first_name, `c_s_a_s`.last_name, `c_s_a_s`.courses_course_id, `c_s_a_s`.s_date, `c_s_a_s`.e_date, `c_s_a_s`.int_date FROM ( SELECT `students`.student_id, `students`.first_name, `students`.last_name, `students_have_courses`.courses_course_id, `students_have_courses`.s_date, `students_have_courses`.e_date, `students_have_courses`.int_date FROM `students` LEFT OUTER JOIN `students_have_courses` ON ( `students_have_courses`.`students_student_id` = `students`.`student_id` AND (( `students_have_courses`.`s_date` >= `students`.`status_change_date` AND `students`.current_status = 'Retread' ) OR `students`.current_status = 'Active') ) WHERE `students`.current_status = 'Active' OR `students`.current_status = 'Retread' ) `c_s_a_s` ORDER BY `c_s_a_s`.`courses_course_id` DESC ) `students_and_courses` LEFT OUTER JOIN `students_have_optional_courses` ON ( `students_have_optional_courses`.students_student_id = `students_and_courses`.student_id AND `students_have_optional_courses`.s_date >= `students_and_courses`.s_date AND `students_have_optional_courses`.e_date IS NULL ) GROUP BY `students_and_courses`.student_id; What I want to be returned is the student_id, first_name, and last_name for all Active or Retread students and then LEFT JOIN the highest course_id, s_date, e_date, and int_date for the those students where the s_date is since the status_change_date if status is 'Retread'. Then LEFT JOIN the highest optional_courses_opcourse_id, s_date, and e_date from the students_have_optional_courses TABLE where the students_have_optional_courses.s_date is greater or equal to the students_have_courses.s_date and the students_have_optional_courses.e_date IS NULL Here is what is being returned: student_id first_name last_name courses_course_id s_date e_date int_date optional_courses_opcourse_id s_date_1 e_date_1 ------------ ------------ ----------- ------------------- ---------- ---------- ------------ ------------------------------ ---------- ---------- 1 John Doe 2 2012-01-05 NULL NULL 1 2012-01-06 NULL 2 Jane Doe NULL NULL NULL NULL NULL NULL NULL Here is what I want being returned: student_id first_name last_name courses_course_id s_date e_date int_date optional_courses_opcourse_id s_date_1 e_date_1 ------------ ------------ ----------- ------------------- ---------- ---------- ------------ ------------------------------ ---------- ---------- 1 John Doe 2 2012-01-05 NULL NULL 5 2012-01-07 NULL 2 Jane Doe NULL NULL NULL NULL NULL NULL NULL Everything is working except one thing, I cannot seem to get the highest students_have_optional_courses.optional_courses_opcourse_id no matter how I form the query Sorry, I just solved this myself after writing this all out I think it helped me think of the solution. Here is the solution query: SELECT `students_and_courses`.student_id, `students_and_courses`.first_name, `students_and_courses`.last_name, `students_and_courses`.courses_course_id, `students_and_courses`.s_date, `students_and_courses`.e_date, `students_and_courses`.int_date, `students_optional_courses`.optional_courses_opcourse_id, `students_optional_courses`.s_date, `students_optional_courses`.e_date FROM ( SELECT `c_s_a_s`.student_id, `c_s_a_s`.first_name, `c_s_a_s`.last_name, `c_s_a_s`.courses_course_id, `c_s_a_s`.s_date, `c_s_a_s`.e_date, `c_s_a_s`.int_date FROM ( SELECT `students`.student_id, `students`.first_name, `students`.last_name, `students_have_courses`.courses_course_id, `students_have_courses`.s_date, `students_have_courses`.e_date, `students_have_courses`.int_date FROM `students` LEFT OUTER JOIN `students_have_courses` ON ( `students_have_courses`.`students_student_id` = `students`.`student_id` AND (( `students_have_courses`.`s_date` >= `students`.`status_change_date` AND `students`.current_status = 'Retread' ) OR `students`.current_status = 'Active') ) WHERE `students`.current_status = 'Active' OR `students`.current_status = 'Retread' ) `c_s_a_s` ORDER BY `c_s_a_s`.`courses_course_id` DESC ) `students_and_courses` LEFT OUTER JOIN ( SELECT * FROM `students_have_optional_courses` ORDER BY `students_have_optional_courses`.optional_courses_opcourse_id DESC ) `students_optional_courses` ON ( `students_optional_courses`.students_student_id = `students_and_courses`.student_id AND `students_optional_courses`.s_date >= `students_and_courses`.s_date AND `students_optional_courses`.e_date IS NULL ) GROUP BY `students_and_courses`.student_id;

    Read the article

  • LINQ to SQL left outer joins

    - by César
    Is this query equivalent to a LEFT OUTER join? var rows = from a in query join s in context.ViewSiteinAdvise on a.Id equals s.SiteInAdviseId where a.Order == s.Order select new {....}; I tried this but it did not result from s in ViewSiteinAdvise join q in query on s.SiteInAdviseId equals q.Id into sa from a in sa.DefaultIfEmpty() where s.Order == a.Order select new {s,a} I need all columns from View

    Read the article

  • What join in Linq i have to use to do what i want?

    - by Garcia Julien
    Hi, I have two dataset from different server. I have result like that (if image doesn't work my data) The problem is at last, i've got only the result from the first table like that And i would like to have all the result for different job type like that asset job jan feb mar ... 5000 acc 10 11 12 5000 over 10 11 12 The problem is not solve with a right join because it's the same problem Could you help me? Thank Ju

    Read the article

  • "SELECT TOP", "LEFT OUTER JOIN", "ORDER BY" gives extra rows

    - by Codesleuth
    I have the following Access query I'm running through OLE DB in .NET: SELECT TOP 25 tblClient.ClientCode, tblRegion.Region FROM (tblClient LEFT OUTER JOIN tblRegion ON tblClient.RegionCode = tblRegion.RegionCode) ORDER BY tblRegion.Region There are 431 records within tblClient that have RegionCode set to NULL. For some reason, the query above returns all these 431 records instead of the first 25. If I change the query to ORDER BY tblClient.Client (the name of the client) like so: SELECT TOP 25 tblClient.ClientCode, tblRegion.Region FROM (tblClient LEFT OUTER JOIN tblRegion ON tblClient.RegionCode = tblRegion.RegionCode) ORDER BY tblClient.Client I get the expected result set of 25 records, showing a mixture of region names and NULL values. Why is it that ordering by a field retrieved through a LEFT OUTER JOIN will the TOP clause not work?

    Read the article

  • Inner join and outer join options in Entity Framework 4.0

    - by bigb
    I am using EF 4.0 and I need to implement query with one inner join and with N outer joins I started to implement this using different approaches but get into trouble at some point. Here is two examples how I started of doing this using ObjectQuery<'T' and Linq to Entity 1)Using ObjectQuery<'T' I implement flexible outer join but I don't know how to perform inner join with entity Rules in that case (by default Include("Rules") doing outer join, but i need to inner join by Id). public static IEnumerable<Race> GetRace(List<string> includes, DateTime date) { IRepository repository = new Repository(new BEntities()); ObjectQuery<Race> result = (ObjectQuery<Race>)repository.AsQueryable<Race>(); //perform outer joins with related entities if (includes != null) foreach (string include in includes) result = result.Include(include); //here i need inner join insteard of default outer join result = result.Include("Rules"); return result.ToList(); } 2)Using Linq To Entity I need to have kind of outer join(somethin like in GetRace()) where i may pass a List with entities to include) and also i need to perform correct inner join with entity Rules public static IEnumerable<Race> GetRace2(List<string> includes, DateTime date) { IRepository repository = new Repository(new BEntities()); IEnumerable<Race> result = from o in repository.AsQueryable<Race>() from b in o.RaceBetRules select new { o }); //I need here: // 1. to perform the same way inner joins with related entities like with ObjectQuery above //here i getting List<AnonymousType> which i cant cast to //IEnumerable<Race> when i did try to cast like //(IEnumerable<Race>)result.ToList(); i did get error: //Unable to cast object of type //'System.Collections.Generic.List`1[<>f__AnonymousType0`1[BetsTipster.Entity.Tip.Types.Race]]' //to type //'System.Collections.Generic.IEnumerable`1[BetsTipster.Entity.Tip.Types.Race]'. return result.ToList(); } May be someone have some ideas about that.

    Read the article

  • Select columns from join table only without requiring a join

    - by Kent Boogaart
    Given these tables: create table Orders ( Id INT IDENTITY NOT NULL, primary key (Id) ) create table Items ( Id INT IDENTITY NOT NULL, primary key (Id) ) create table OrdersItems ( OrderId INT not null, ItemId INT not null, primary key (OrderId, ItemId) ) Is it possible to use HQL/criteria API to contruct a query that results in the following SQL: SELECT [OrderId], [ItemId] FROM [OrdersItems] I've tried both of these approaches: var hqlResults = session .CreateQuery("select order.id, item.id from Order order inner join order.Items item") .List(); var criteriaResults = session .CreateCriteria<Order>() .CreateAlias("Items", "item", NHibernate.SqlCommand.JoinType.None) .SetProjection(Projections.Property("id"), Projections.Property("item.id")) .List(); But both approaches insist on generating a join (or fail because the join isn't present, in using criteria), resulting in SQL such as: select order.Id, item.Id from Orders order inner join OrdersItems ordersItems on order.Id = ordersItems.ArticleId inner join Items item on ordersItems.CategoryId = item.Id Is there any way to have NHibernate generate a query that selects columns only from the join table, without requiring a join?

    Read the article

  • Linq Left Outer Join

    - by Neil
    I am new to LINQ and am trying to convert a SQL query to LINQ: SQL: left outer join PRODUCT_BEST_USE pbu on pbu.PRODUCT_GUID = @uProductId and pbu.BEST_USE_GUID = bu.BEST_USE_GUID LINQ: from PBU in PRODUCT_BEST_USE.Where(PBU=>PBU.PRODUCT_GUID == p.PRODUCT_GUID).DefaultIfEmpty() When I add and PBU.BEST_USE_GUID equals BU.BEST_USE_GUID, I get an error: "A query body must end with a select clause or a group clause" Here is the full Linq query: from p in PRODUCT join BU in BEST_USE on p.CATEGORY_GUID equals BU.CATEGORY_GUID from PBU in PRODUCT_BEST_USE.Where(PBU=>PBU.PRODUCT_GUID == p.PRODUCT_GUID).DefaultIfEmpty() and PBU.BEST_USE_GUID equals BU.BEST_USE_GUID where p.PRODUCT_GUID == new Guid("d317752b-581d-4f43-92fa-4a4af91009f5") select new { BU.NAME, PBU.PRODUCT_BEST_USE_GUID }

    Read the article

  • Full outer join in django

    - by Ber
    How can I create a query for a full outer join across a M2M relationchip using the django QuerySet API? It that is not supported, some hint about creating my own manager to do this would be welcome. Edited to add: @S.Lott: Thanks for the enlightenment. The need for the OUTER JOIN comes from the application. It has to generate a report showing the data entered, even if it still incomplete. I was not aware of the fact that the result would be a new class/model. Your hints will help me quite a bit.

    Read the article

  • Using CASE Statements in LEFT OUTER JOIN in SQL

    - by s khan
    I've got a scenario where I want to switch on two different tables in an outer join. It goes something like this:- select mytable.id, yourtable.id from mytable left outer join (case when mytable.id = 2 then table2 yourtable on table1.id = table2.id else table3 yourtable on table1.id = table3.id end) ...but it doesn't work. Any suggestions?

    Read the article

  • linq to entites left outer join

    - by parminder
    I am struggling linq to entities left outer join. I have two entities (tables): Listings { ListingID, MakeID (nullable) } Makes { MakeID, Description } I want to write something like this in LINQ: select listings.listingID ,listings.makeid , IsNull(makes.Description, 'NA') from listings left outer join makes on listings.makeid = makes.makeid

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >