Search Results

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

Page 9/274 | < Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • MySQL Join Comma Separated Field

    - by neeraj
    I have two tables. First Table is a batch table that contain comma separated student id in field "batch" batch -------------- id batch -------------- 1 1,2 2 3,4 Second Table is marks marks ---------------------- id studentid subject marks 1 1 English 50 2 2 English 40 3 3 English 70 4 1 Math 65 5 4 English 66 6 5 English 75 7 2 Math 55 How we can find those students of first batch id =1 who have scored more than 45 marks in English without using sub query. Problem i found to get this done using a single query is that we can not use IN as an association operator in JOIN statement What changes are required in below query to make it work? SELECT * FROM batch INNER JOIN marks ON marks.studentid IN(batch.batch) where batch.id = 1

    Read the article

  • C# LINQ join With Just One Row

    - by Soo
    I'm trying to make a query that grabs a single row from an SQL database and updates it. TableA AId AValue TableB BId AId BValue Ok, so TableA and TableB are linked by AId. I want to select a row in TableB based on AValue using a join. The following query is what I have and only grabs a value from TableB based on AId, I just don't know how to grab a row from TableB using AValue. I know you would need to use a join, but I'm not sure how to accomplish that. var row = DbObject.TableB.Single(x => x.AId == 1) row.BValue = 1; DbObject.SubmitChanges();

    Read the article

  • MySQL AND alternative for eatch table in a join

    - by Scott
    I have a simple join in a query however I need to have a condition on both of the tables "confirmed='yes'" but if one of the tables doesn't have any that match the query returns with no rows. Database: .----------parties----------. | id - party_id - confirmed | |---------------------------| | 1 1 yes | | 1 2 no | | 1 3 no | +---------------------------+ .-----------events----------. | id - event_id - confirmed | |---------------------------| | 1 1 no | +---------------------------+ Query: SELECT p.party_id, e.event_id FROM parties p LEFT JOIN events e ON p.id=e.id WHERE p.id = '1' AND p.party_id IN (1,2,3) AND e.event_id IN (1) AND p.confirmed='yes' AND e.confirmed='yes' It returns nothing but I want it to return party_id 1 with a empty event_id. I hope this make sense and I not missing anything, Thanks for your help!

    Read the article

  • mysql select multiple rows in join

    - by julio
    Hi-- I have a simple mySQL problem-- I have two tables, one is a user's table, and one is a photos table (each user can upload multiple photos). I'd like to write a query to join these tables, so I can pull all photos associated with a user (up to a certain limit). However, when I do something obvious like this: SELECT *.a, *.b FROM user_table a JOIN photos_table b ON a.id = b.userid it returns a.id, a.name, a.email, a.address, b.id, b.userid, b.photo_title, b.location but it only returns a single photo. Is there a way to return something like: a.id, a.name, a.email, a.address, b.id, b.userid, b.photo_title, b.location, b.id2, b.photo_title2, b.location2 etc. . . for a given LIMIT of photos? Thanks for any ideas.

    Read the article

  • MySQL AND alternative for each table in a join

    - by Scott
    I have a simple join in a query however I need to have a condition on both of the tables "confirmed='yes'" but if one of the tables doesn't have any that match the query returns with no rows. Database: .----------parties----------. | id - party_id - confirmed | |---------------------------| | 1 1 yes | | 1 2 no | | 1 3 no | +---------------------------+ .-----------events----------. | id - event_id - confirmed | |---------------------------| | 1 1 no | +---------------------------+ Query: SELECT p.party_id, e.event_id FROM parties p LEFT JOIN events e ON p.id=e.id WHERE p.id = '1' AND p.party_id IN (1,2,3) AND e.event_id IN (1) AND p.confirmed='yes' AND e.confirmed='yes' It returns nothing but I want it to return party_id 1 with a empty event_id. I hope this make sense and I not missing anything, Thanks for your help!

    Read the article

  • SQL Outer Join on a bunch of Inner Joined results

    - by Matthew Frederick
    I received some great help on joining a table to itself and am trying to take it to the next level. The SQL below is from the help but with my addition of the select line beginning with COUNT, the inner join to the Recipient table, and the Group By. SELECT Event.EventID AS EventID, Event.EventDate AS EventDateUTC, Participant2.ParticipantID AS AwayID, Participant1.ParticipantID AS HostID, COUNT(Recipient.ChallengeID) AS AllChallenges FROM Event INNER JOIN Matchup Matchup1 ON (Event.EventID = Matchup1.EventID) INNER JOIN Matchup Matchup2 ON (Event.EventID = Matchup2.EventID) INNER JOIN Participant Participant1 ON (Matchup1.Host = 1 AND Matchup1.ParticipantID = Participant1.ParticipantID) INNER JOIN Participant Participant2 ON (Matchup2.Host != 1 AND Matchup2.ParticipantID = Participant2.ParticipantID) INNER JOIN Recipient ON (Event.EventID = Recipient.EventID) WHERE Event.CategoryID = 1 AND Event.Resolved = 0 AND Event.Type = 1 GROUP BY Recipient.ChallengeID ORDER BY EventDateUTC ASC My goal is to get a count of how many rows in the Recipient table match the EventID in Event. This code works fine except that I also want to get results where there are 0 matching rows in Recipient. I want 15 rows (= the number of events) but I get 2 rows, one with a count of 1 and one with a count of 2 (which is appropriate for an inner join as there are 3 rows in the sample Recipient table, one for one EventID and two for another EventID). I thought that either a LEFT join or an OUTER join was what I was looking for, but I know that I'm not quite getting how the tables are actually joined. A LEFT join there gives me one more row with 0, which happens to be EventID 1 (first thing in the table), but that's all. Errors advise me that I can't just change that INNER join to an OUTER. I tried some parenthesizing and some subselects and such but can't seem to make it work.

    Read the article

  • MySQL: Complex Join Statement involving two tables and a third correlation table

    - by Stephen
    I have two tables that were built for two disparate systems. I have records in one table (called "leads") that represent customers, and records in another table (called "manager") that are the exact same customers but "manager" uses different fields (For example, "leads" contains an email address, and "manager" contains two fields for two different emails--either of which might be the email from "leads"). So, I've created a correlation table that contains the lead_id and manager_id. currently this correlation table is empty. I'm trying to query the "leads" table to give me records that match either "manager" email field with the single "leads" email field, while at the same time ignoring fields that have already been added to the "correlated" table. (this way I can see how many leads that match have not yet been correlated.) Here's my current, invalid SQL attempt: SELECT leads.id, manager.id FROM leads, manager LEFT OUTER JOIN correlation ON correlation.lead_id = leads.id WHERE correlation.id IS NULL AND leads.project != "someproject" AND (manager.orig_email = leads.email OR manager.dest_email = leads.email) AND leads.created BETWEEN '1999-01-01 00:00:00' AND '2010-05-10 23:59:59' ORDER BY leads.created ASC; I get the error: Unknown column 'leads.id' in 'on clause' Before you wonder: there are records in the "leads" table where leads.project != "someproject" and leads.created falls between those dates. I've included those additional parameters for completeness.

    Read the article

  • how to create a linq query using join and max

    - by geoff swartz
    I have 2 tables in my linq dbml. One is people with a uniqueid called peopleid and the other is a vertical with a foreign key for peopleid and a uniqueid called id. I need to create a type of linq query that does a left outer join on people and gets the latest record in the vertical table based off the max(id) column. Can anyone suggest what this should look like? Thanks.

    Read the article

  • Join and sum not compatible matrices through data.table

    - by leodido
    My goal is to "sum" two not compatible matrices (matrices with different dimensions) using (and preserving) row and column names. I've figured this approach: convert the matrices to data.table objects, join them and then sum columns vectors. An example: > M1 1 3 4 5 7 8 1 0 0 1 0 0 0 3 0 0 0 0 0 0 4 1 0 0 0 0 0 5 0 0 0 0 0 0 7 0 0 0 0 1 0 8 0 0 0 0 0 0 > M2 1 3 4 5 8 1 0 0 1 0 0 3 0 0 0 0 0 4 1 0 0 0 0 5 0 0 0 0 0 8 0 0 0 0 0 > M1 %ms% M2 1 3 4 5 7 8 1 0 0 2 0 0 0 3 0 0 0 0 0 0 4 2 0 0 0 0 0 5 0 0 0 0 0 0 7 0 0 0 0 1 0 8 0 0 0 0 0 0 This is my code: M1 <- matrix(c(0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0), byrow = TRUE, ncol = 6) colnames(M1) <- c(1,3,4,5,7,8) M2 <- matrix(c(0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0), byrow = TRUE, ncol = 5) colnames(M2) <- c(1,3,4,5,8) # to data.table objects DT1 <- data.table(M1, keep.rownames = TRUE, key = "rn") DT2 <- data.table(M2, keep.rownames = TRUE, key = "rn") # join and sum of common columns if (nrow(DT1) > nrow(DT2)) { A <- DT2[DT1, roll = TRUE] A[, list(X1 = X1 + X1.1, X3 = X3 + X3.1, X4 = X4 + X4.1, X5 = X5 + X5.1, X7, X8 = X8 + X8.1), by = rn] } That outputs: rn X1 X3 X4 X5 X7 X8 1: 1 0 0 2 0 0 0 2: 3 0 0 0 0 0 0 3: 4 2 0 0 0 0 0 4: 5 0 0 0 0 0 0 5: 7 0 0 0 0 1 0 6: 8 0 0 0 0 0 0 Then I can convert back this data.table to a matrix and fix row and column names. The questions are: how to generalize this procedure? I need a way to automatically create list(X1 = X1 + X1.1, X3 = X3 + X3.1, X4 = X4 + X4.1, X5 = X5 + X5.1, X7, X8 = X8 + X8.1) because i want to apply this function to matrices which dimensions (and row/columns names) are not known in advance. In summary I need a merge procedure that behaves as described. there are other strategies/implementations that achieve the same goal that are, at the same time, faster and generalized? (hoping that some data.table monster help me) to what kind of join (inner, outer, etc. etc.) is assimilable this procedure? Thanks in advance. p.s.: I'm using data.table version 1.8.2 EDIT - SOLUTIONS @Aaron solution. No external libraries, only base R. It works also on list of matrices. add_matrices_1 <- function(...) { a <- list(...) cols <- sort(unique(unlist(lapply(a, colnames)))) rows <- sort(unique(unlist(lapply(a, rownames)))) out <- array(0, dim = c(length(rows), length(cols)), dimnames = list(rows,cols)) for (m in a) out[rownames(m), colnames(m)] <- out[rownames(m), colnames(m)] + m out } @MadScone solution. Used reshape2 package. It works only on two matrices per call. add_matrices_2 <- function(m1, m2) { m <- acast(rbind(melt(M1), melt(M2)), Var1~Var2, fun.aggregate = sum) mn <- unique(colnames(m1), colnames(m2)) rownames(m) <- mn colnames(m) <- mn m } BENCHMARK (100 runs with microbenchmark package) Unit: microseconds expr min lq median uq max 1 add_matrices_1 196.009 257.5865 282.027 291.2735 549.397 2 add_matrices_2 13737.851 14697.9790 14864.778 16285.7650 25567.448 No need to comment the benchmark: @Aaron solution wins. I'll continue to investigate a similar solution for data.table objects. I'll add other solutions eventually reported or discovered.

    Read the article

  • Hibernate Criteria: Perform JOIN in Subquery/DetachedCriteria

    - by Gilean
    I'm running into an issue with adding JOIN's to a subquery using DetachedCriteria. The code looks roughly like this: Criteria criteria = createCacheableCriteria(ProductLine.class, "productLine"); criteria.add(Expression.eq("productLine.active", "Y")); DetachedCriteria subCriteria = DetachedCriteria.forClass(Models.class, "model"); subCriteria.setProjection(Projections.rowCount()); subCriteria.createAlias("model.language", "modelLang"); criteria.add(Expression.eq("modelLang.language_code", "EN")); subCriteria.add(Restrictions.eqProperty("model.productLine.id","productLine.id")); criteria.add(Subqueries.lt(0, subCriteria)); But the logged SQL does not contain the JOIN in the subquery, but does include the alias which is throwing an error SELECT * FROM PRODUCT_LINES this_ WHERE this_.ACTIVE=? AND ? < (SELECT COUNT(*) AS y0_ FROM MODELS this0__ WHERE modelLang3_.LANGUAGE ='EN' AND this0__.PRODUCT_LINE_ID =this_.ID ) How can I add the joins to the DetachedCriteria? Hibernate version: 3.2.6.ga Hibernate core: 3.3.2.GA Hibernate annotations: 3.4.0.GA Hibernate commons-annotations: 3.3.0.ga Hibernate entitymanager: 3.4.0.GA Hibernate validator: 3.1.0.GA

    Read the article

  • solr JOIN query

    - by Sfairas
    I need to run a JOIN query on a solr index. I've got two xmls that I have indexed, person.xml and subject.xml. Person: <doc> <field name="id">P39126</field> <field name="family">Smith</field> <field name="given">John</field> <field name="subject">S1276</field> <field name="subject">S1312</field> </doc> Subject: <doc> <field name="id">S1276</field> <field name="topic">Abnormalities, Human</field> </doc> I need to only display information from the person doc but each query should match fields in both person and subject. In the case the query matches only the subject doc I need to display all docs from the person that have a matching id. Is this possible to do without running two seperate queries? Something like a JOIN query would do the job. Any help?

    Read the article

  • Linq join with an inner collection

    - by bronze
    Hi, I am trying a LINQ to Object query on 2 collections Customer.Orders Branches.Pending.Orders (Collection within a collection) I want to output each branch which is yet to deliver any order of the customer. var match = from order in customer.Orders join branch in Branches on order equals branch.Pending.Orders select branch; This does not work, I get : The type of one of the expressions in the join clause is incorrect. Type inference failed in the call to 'GroupJoin'. From my search, I think this is because Order or collection of Orders does not implement equals. If this query worked, it will still be wrong, as it will return a branch if the customer's and pending orders match exactly. I want a result if any of the order matches. I am learning Linq, and looking for a approach to address such issues, rather than the solution itself. I would have done this in SQL like this; SELECT b.branch_name from Customers c, Branches b, Orders o WHERE c.customer_id = o.customer_id AND o.branch_id = b.branch_id AND c.customer_id = 'my customer' AND o.order_status = 'pending'

    Read the article

  • using a JOIN in an UPDATE in SQL

    - by SDLFunTimes
    Hi, I'm having trouble formulating a legal statement to double the statuses of the suppliers (s) who have shipped (sp) more than 500 units. I've been trying: update s set s.status = s.status * 2 from s join sp on (sp.sno = s.sno) group by sno having sum(qty) > 500; however I'm getting this error from Mysql: ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from s join sp on (sp.sno = s.sno) group by sno having sum(qty) > 500' at line 1 Does anyone have any ideas about what is wrong with this query? Here's my schema: create table s ( sno char(5) not null, sname char(20) not null, status smallint, city char(15), primary key (sno) ); create table p ( pno char(6) not null, pname char(20) not null, color char(6), weight smallint, city char(15), primary key (pno) ); create table sp ( sno char(5) not null, pno char(6) not null, qty integer not null, primary key (sno, pno) );

    Read the article

  • SQL statement to split a table based on a join

    - by williamjones
    I have a primary table for Articles that is linked by a join table Info to a table Tags that has only a small number of entries. I want to split the Articles table, by either deleting rows or creating a new table with only the entries I want, based on the absence of a link to a certain tag. There are a few million articles. How can I do this? Not all of the articles have any tag at all, and some have many tags. Example: table Articles primary_key id table Info foreign_key article_id foreign_key tag_id table Tags primary_key id It was easy for me to segregate the articles that do have the match right off the bat, so I thought maybe I could do that and then use a NOT IN statement but that is so slow running it's unclear if it's ever going to finish. I did that with these commands: INSERT INTO matched_articles SELECT * FROM articles a LEFT JOIN info i ON a.id = i.article_id WHERE i.tag_id = 5; INSERT INTO unmatched_articles SELECT * FROM articles a WHERE a.id NOT IN (SELECT m.id FROM matched_articles m); If it makes a difference, I'm on Postgres.

    Read the article

  • JOIN (SELECT DISTINCT [..] substitute

    - by FRKT
    Hello, I'd like to find a substitute for using SELECT DISTINCT in a derived table. Let's say I have three tables: CREATE TABLE `trades` ( `tradeID` int(11) unsigned NOT NULL AUTO_INCREMENT, `employeeID` int(11) unsigned NOT NULL, `corporationID` int(11) unsigned NOT NULL, `profit` int(11) NOT NULL, KEY `tradeID` (`tradeID`), KEY `employeeID` (`employeeID`), KEY `corporationID` (`corporationID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE `corporations` ( `corporationID` int(11) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, PRIMARY KEY (`corporationID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE `employees` ( `employeeID` int(11) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, PRIMARY KEY (`employeeID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 Let's say I'd like to find out how much profit a specific employee has generated. Simple: SELECT SUM(profit) FROM trades JOIN employees ON trades.employeeID = employees.employeeID AND employees.employeeID = 1; It gets trickier if I'd like to query how much revenue a specific corporation has, however. I cannot simply replicate the aforementioned query, because two or more employees from the same company might be involved in the same trade. This query should do the trick: SELECT SUM(profit) FROM trades JOIN (SELECT DISTINCT tradeID FROM trades WHERE trades.corporationID = 1) ... unfortunately, DISTINCT JOINs seem crazy ineffective. Is there any alternative I can use to determine how much revenue a corporation has, taking into account that a corporation might be listed several times with the same tradeID?

    Read the article

  • Hibernate HQL m:n join problem

    - by smallufo
    I am very unfamiliar with SQL/HQL , and am currently stuck with this 'maybe' simple problem : I have two many-to-many Entities , with a relation table : Car , CarProblem , and Problem . One Car may have many Problems , One Problem may appear in many Cars, CarProblem is the association table with other properties . Now , I want to find Car(s) with specified Problem , how do I write such HQL ? All ids are Long type . I've tried a lot of join / inner-join combinations , but all in vain.. -- updated : Sorry , forget to mention : Car has many CarProblem Problem has many CarProblem Car and Problem are not directly connected in Java Object. -- update , java code below -- @Entity public class Car extends Model{ @OneToMany(mappedBy="car" , cascade=CascadeType.ALL) public Set<CarProblem> carProblems; } @Entity public class CarProblem extends Model{ @ManyToOne public Car car; @ManyToOne public Problem problem; ... other properties } @Entity public class Problem extends Model { other properties ... // not link to CarProblem , It seems not related to this problem // **This is a very stupid query , I want to get rid of it ...** public List<Car> findCars() { List<CarProblem> list = CarProblem.find("from CarProblem as cp where cp.problem.id = ? ", id).fetch(); Set<Car> result = new HashSet<Car>(); for(CarProblem cp : list) result.add(cp.car); return new ArrayList<Car>(result); } } The Model is from Play! framework , so these properties are all public .

    Read the article

  • Left Join only returning one row

    - by Adam
    I am trying to join two tables. I would like all the columns from the product_category table (there are a total of 6 now) and count the number of products, CatCount, that are in each category from the products_has_product_category table. My query result is 1 row with the first category and a total count of 68, when I am looking for 6 rows with each individual category's count. <?php $result = mysql_query(" SELECT a.*, COUNT(b.category_id) AS CatCount FROM `product_category` a LEFT JOIN `products_has_product_category` b ON a.product_category_id = b.category_id "); while($row = mysql_fetch_array($result)) { echo ' <li class="ui-shadow" data-count-theme="d"> <a href="' . $row['product_category_ref_page'] . '.php" data-icon="arrow-r" data-iconpos="right">' . $row['product_category_name'] . '</a><span class="ui-li-count">' . $row['CatCount'] . '</span></li>'; } ?> I have been working on this for a couple of hours and would really appreciate any help on what I am doing wrong.

    Read the article

  • Yet another use of OUTER APPLY in defensive programming

    - by Alexander Kuznetsov
    When a SELECT is used to populate variables from a subquery, it fails to change them if the subquery returns nothing - and that can lead to subtle bugs. We shall use OUTER APPLY to eliminate this problem. Prerequisites All we need is the following mock function that imitates a subquery: CREATE FUNCTION dbo.BoxById ( @BoxId INT ) RETURNS TABLE AS RETURN ( SELECT CAST ( 1 AS INT ) AS [Length] , CAST ( 2 AS INT ) AS [Width] , CAST ( 3 AS INT ) AS [Height] WHERE @BoxId = 1 ) ; Let us assume that this...(read more)

    Read the article

  • Fun with Outer Joins

    Learn how an outer join works and how you can use it in your applications to find the results you need when matching data isn't in all your tables. Keep your database and application development in syncSQL Connect is a Visual Studio add-in that brings your databases into your solution. It then makes it easy to keep your database in sync, and commit to your existing source control system. Find out more.

    Read the article

  • In SQL / MySQL, can a Left Outer Join be used to find out the duplicates when there is no Primary ID

    - by Jian Lin
    I would like to try using Outer Join to find out duplicates in a table: If a table has Primary Index ID, then the following outer join can find out the duplicate names: mysql> select * from gifts; +--------+------------+-----------------+---------------------+ | giftID | name | filename | effectiveTime | +--------+------------+-----------------+---------------------+ | 2 | teddy bear | bear.jpg | 2010-04-24 04:36:03 | | 3 | coffee | coffee123.jpg | 2010-04-24 05:10:43 | | 6 | beer | beer_glass.png | 2010-04-24 05:18:12 | | 10 | heart | heart_shape.jpg | 2010-04-24 05:11:29 | | 11 | ice tea | icetea.jpg | 2010-04-24 05:19:53 | | 12 | cash | cash.png | 2010-04-24 05:27:44 | | 13 | chocolate | choco.jpg | 2010-04-25 04:04:31 | | 14 | coffee | latte.jpg | 2010-04-27 05:49:52 | | 15 | coffee | espresso.jpg | 2010-04-27 06:03:03 | +--------+------------+-----------------+---------------------+ 9 rows in set (0.00 sec) mysql> select * from gifts g1 LEFT JOIN (select * from gifts group by name) g2 on g1.giftID = g2.giftID where g2.giftID IS NULL; +--------+--------+--------------+---------------------+--------+------+----------+---------------+ | giftID | name | filename | effectiveTime | giftID | name | filename | effectiveTime | +--------+--------+--------------+---------------------+--------+------+----------+---------------+ | 14 | coffee | latte.jpg | 2010-04-27 05:49:52 | NULL | NULL | NULL | NULL | | 15 | coffee | espresso.jpg | 2010-04-27 06:03:03 | NULL | NULL | NULL | NULL | +--------+--------+--------------+---------------------+--------+------+----------+---------------+ 2 rows in set (0.00 sec) But what if the table doesn't have a Primary Index ID, then can an outer join still be used to find out duplicates?

    Read the article

  • Oracle - Update statement with inner join

    - by user169743
    I have a query which works fine in MySQL, I'm trying to get it working on oracle but get the following error SQL Error: ORA-00933: SQL command not properly ended 00933. 00000 - "SQL command not properly ended" The query is: UPDATE table1 INNER JOIN table2 ON table1.value = table2.DESC SET table1.value = table2.CODE WHERE table1.UPDATETYPE='blah'; I'd be extremely grateful for any help.

    Read the article

  • SQL is this equvelent to a LEFT JoIn?

    - by Jim
    Is this equvelent to a LEFT JOIN? select distinct a.name, b.name from tableA a, (select name from tableB) as b It seems as though there is no link between the two tables. Is there an easier / more efficient way to write this?

    Read the article

  • How to do a join that removes values?

    - by Georg
    Customers Holidays id | name customer_id | start | end ---+------ ------------+--------+------ 1 | Peter 1 | 5 | 10 2 | Simon 1 | 15 | 20 3 | Mary 2 | 5 | 20 How should my SQL query look that out of start=11,end=14 I get these customers: Peter Mary Is this even manageable with a simple SQL join, or do I need to use sub-queries?

    Read the article

  • Self join to a table

    - by Mohit
    I have a table like Employee ================== name salary ================== a 10000 b 20000 c 5000 d 40000 i want to get all the employee whose salary is greater than A's salary. I don't want to use any nested or sub query. It has been asked in an interview and hint was to use self join. I really can't figure out how to achieve the same.

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >