.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Post New Web Links

Self Join?

Posted By:      Posted Date: September 08, 2010    Points: 0   Category :ASP.Net
I am trying to preform to get an Employee's Boss, Boss's Boss, Boss's Boss's Boss, etc...  I am think a self join like below would work. SELECT Emp, Leader FROM Table AS Table_1JOIN Table as Table_2 ON  Table_1.EMP = Table_2.EMP WHERE  Table_1.Leader = Table_2.EmpAND Table_1.EMP = 'Employee' If you where to run this, you only get the person in the And part of the clause and no one else. Can someone point me into the right direction? Thank you in advance.

View Complete Post

More Related Resource Links

Join Two Tables and Prepare Report



            I have a select query which is executing well. Now, I want to add one more field to that query. That field is not in the current query table, It is in the another table.

How do I join those two tables and get that field value in the existing select query.?


Linq join fields for return data


  how would I join fields together?

           return (from c in storedb.Product_Categories

                         where c.Category_Name.Contains(searchText)
                         orderby c.Category_Name
                         select new {
                                    c.Category_Key && " ;" && c.Category_Name // HOW CAN I DO THIS.....

How to join two sharepoint list in c# by CAML query?

Hii All,
   I am using wss 3.0 and i have one site and site has 4 to 5 lists. lists are interconnected with lookup column and same column. I need to display some column fron one list and some from another.. i need to join that lists by where condition like project =project..

So how can i join??

Thank You

Cannot properly join lists in SPD 2007


Ok, I have been reading all sorts of posts and such for about a week and still have no come up with any concrete answers.


I cannot properly join lists in SP 07. I say properly because I never get the option to select a field to associate one with the other. 

I select "Create new linked data source" from Data Source Library; Pane opens; Left Click "Configure Linked Data Source"; Add 4 to 5 lists from "Current Site"; Select Next; Select Join option but Next is greyed out. Is this supposed to be greyed out because they are lists? Can lists be joined? I see alot of examples on joining databases and excel pages but not too many on lists.

If I select next from the last point, open the linked sources and select my newly created linked source and click to show data, I can see all of the information in there. Problem is I don't believe the lists are really joined by anything since I never received an option for it. 

I also have been reading up on joined subviews but I never receive an option for  joined subview. Is the joined subview the way to go for lists? If so how?


I know these boards are fairly active and any information or help would be greatly appreciated.

insert into in combination with inner join


Hi All,

I have my data split in 3 tables for cascading dropdownlists.

How can I make an update statement of this select statement?

SELECT distinct BIER.Naam as naam1, BIER_L2.L2_Naam as naam2, BIER_L3.L3_Naam as naam3
	from BIER, BIER_L2, BIER_L3
	where BIER_L2.L2_ID = BIER.L2_ID and BIER_L2.L3_ID = BIER_L3.L3_ID 



Join 2 flat file data flows - retain unmatched rows

I have two data flows from two separate flat files. They may contain matching IDs (account number), in this case specific data from each flow should be used to create one row. When there is no match, the rows would stand on their own. At the end of the flow, I need both flows combined into one flow, with one record for each key record (account number). If I were able to use a look-up, I could easily union the no-match data flow back into the match data flow and have the desired result. I cannot use a look-up, since the source is flat files, but this is exactly the functionality I am trying to achieve. Solutions I want to avoid: staging tables, and cache transformations. Any ideas are appreciated.

repeating merge joins using full outer join - should be possible without sort, but cannot get the co

Hello,   I am trying to combine several source tables with Merge Join.  For the Moment I have three source tables all already sorted in the source query and the is sorted property with the correct keys set. (its an aggregate query with group by and sort by the key columns) Then I do a merge join between two of the tables - with a full outer join. Then I just want to do another merge join with the output of the next result. but as the merge join do not combine the key columns into one column I need to add a derived column which substitute null values on the left side of the join with values from the right side of the join. The second merge then says only the left columns of the first merge join is sorted, but not the comined columns. If i Replace with a derived column the left side primary key columsn with the combinded key columns the next merge join says the input is not sorrted? But the output must be sorted. So how do I get the next merge join working without the ssis sort transformation? the data is sorted, but the component does not recognize the sorted data? I do not want to use (can use) the sort because there are flowing >= 500 Mio. records through the pipeline. Any help appreciated.   Hanneshttp://www.hmayer.net/

select max record to join another table sybase

select a.pono,(select (user) from user where userid=a.userid having date=max(date)) as user from a inner join b on a.no=b.no  in the result , i have selected the same id and retrieve two records every thing are same except the date how can i select the record out of two record which date is max date as the where Clasuse to select correct user poid    date                name 1        12/08/2010      Mary 1        20/08/2010      Peter   now i would like to select name which id=1 and date is max and then use the name to join another table because name is foreign key  

problem with inner join

Hi, I'm trying to create an sql query with multiple inner joins, but I can't manage this. I have 3 tables (bookings, accountplan, costs), where the data come from. In accountplan are hold the accounts, in costs the cost codes and their names, in bookings the booked events. Based on a booking event, I need the account name, the name of the cost code and all data from bookings (I need the cred account name too, but I can't figure out yet, how I can get this) I tried this: "SELECT bookings.*, accountplan.accountname, costs.costname FROM bookings INNER JOIN accountplan ON bookings.debaccount=accountplan.account INNER JOIN costs ON bookings.costcode=costs.costcode" It is here a where clause too, but I tested it, it's ok. The above query results no rows. If I remove the costs table and the inner join with it, it works. What am I missing?

Need help on populating data on a datagrid using SQL Join

I have a table called Leaves. Fields are,LeaveIDPersonIDActingPersonIDIn Person's table, I have,PersonalIDEmployeeCodePersonNameNow, in the datagrid, I need to show,PersonEmployeeCodePersonNameActingPersonEmployeeCodeActingPersonNameNow, I know how to write the SQL Join to get the data populated. But, the problem is, in some cases, there won't be any acting person. In which case, I need to display data, PersonEmployeeCode = 0001 PersonName = John ActingPersonEmployeeCode = - ActingPersonName = No acting Person Now, I am stuck here. How do I do a conditional join statement?Please help! RegardsKush

Cross list query for two sharepoint lists and a join between the fields

Hello All, I have a requirement where i need to query the data from two  sharepoint lists  on a same site by doing a join between those lists and get the result into datatable.I am doing this using sharepoint object model.Is there any possibility to do this. Any pointers in the right direction are greatly appreciated. Thank you Smith   smith


Hello EveryOne,               I am making a monthly attendance details of all employees who is working in my company. I am using sql server management studio 2005.       My table is in this format. staffcode   name                                   date            Intime   Outtime Duration                         1               Amit                                  01-08-2010    00:00    00:00    00:00 1              Amit                                   02-08-2010    09:52    20:01    10:09 1&n

any alternative for join tables?

 Hi guys, is  there any alternative for joining tables in ado.net? The problem is i have 2 tables: Transaction pkTransactionID TransactionDate FKTransactionCategory : refers to PKCAtegoryID   Category PKCAtegoryID CategoryName   I need to show a joined information from 2 tables in a gridview and be able to update data in tables. I can join them using linq to entity and show them in gridview. But i need to handle update and insert by myself then. Is there any way to make mapping so i can handle the data in those 2 tables as one table and bind it to bindingsource? Thanks in advance.      

Left Outer Join fails to return all records

I have a table tblDrop that contains 1067 records for 8/31/2010 and a table tblSoftcount that has 739 records, some with bad serial numbers. I need to match all of the records in tblDrop with those in tblSoftcount. I have a query using Left outer join that has worked for the duration of the application, but has recently stopped returing the full set of records from tblDrop. We have not changed the SQL versions on the server (compatibility level 2005). Here is the query: SELECT   v.SlotNum_ID, s.SlotNum_ID, v.PTNumber, s.PTNumber, v.DropBillAmount AS [Drop], v.ReportDate, v.DateValue     FROM tbl_Drop v LEFT OUTER JOIN tblSoftCount s ON v.SlotNum_ID = s.SlotNum_ID AND v.ReportDate = s.ReportDate WHERE   s.ReportDate = '8/31/2010' AND v.DropBillAmount <> 0 AND s.Slotnum_ID IS NULL;  

how to Join two SharePoint Lists in SharePoint 2010

I have one Document Library and One List, just want display data from both based on ID in SharePoint 2010. Document Library : "Doc1" having following columns 1. ID (default column) 2. Title 3. Description 4. Image Url List : "List1" having following columns 1. RefID ( lookup column, refers the doc1 ID column) 2. Created By I want to display get data table for what are the ID's(items) created by me using CAML Query (SPQuery.Joins)  

Join two Lists/Library in SharePoint 2010

I have one Document Library and One List, just want display data from both based on ID in SharePoint 2010. Document Library : "Doc1" having following columns 1. ID (default column) 2. Title 3. Description 4. Image Url List : "List1" having following columns 1. RefID ( lookup column, refers the doc1 ID column) 2. Created By I want to display get data table for what are the ID's(items) created by me using CAML Query (SPQuery.Joins) Pls give me solution... Thanks in adv...

How to join source specific multicast group in c#

I am looking for source code examples in c# to join a multicast group with a specific source.I could not find any object that is equivalent to ip_mreq_source in C# for IP_ADD_SOURCE_MEMBERSHIP.My platform is Windows 2003 server.NET version 3.5
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend