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


Top 5 Contributors of the Month
satyapriyanayak
kelly456
Post New Web Links

Search Query From Multiple Tables

Posted By:      Posted Date: April 10, 2011    Points: 0   Category :ASP.Net
 

Hello,

I have a order master table in which orderId is PK.

Now i have 5 Diffrent tables in which OrderId is FK. Column Name in each table is same.

I want to find all columns by orderId from all 5 tables. that means If i pass the orderid = 5 then query should check for each table and find the orderId = 5 and get all records from that table.

If you think any logic for solve this problem please write. I really thankfull if i got any clue for this.

Thanks & regards

Shwetamber Chourey

India




View Complete Post


More Related Resource Links

MS SQL Server: Search All Tables, Columns & Rows For Data or Keyword Query

  
If you need to search your entire database for specific data, this query will come in handy.

So when a client needs a custom report or some sort of custom development using Great Plains, most of the time I will have to track down the data in the system by running this query and find the table(s) it is in.

Search query with multiple search feilds

  

Hi,

I have a search page with four fields. Each field belongs to columns in the database. None of these fields are mandatory, so user can choose which field/feilds they want to enter. I want the search results to be more specific as they enter values in more than one field.

For example.

First name, Last name, Pin code and Mobile are the 4 search fields.

 

Any help will be appreciated.

Thank you

 


Trouble linking multiple tables in a sql query within a sqldatasource

  

I am trying to link 3 tables within a sqldata source.  when I debug/run the code I recieve an error stateing that I am missing an operator.

My code:

<asp:SqlDataSource ID="SqlDataSource2" runat="server"
        ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>"
        SelectCommand="SELECT [ProductCode], [Title], [TechID], [Description], [DateOpened], [DateClosed]
            FROM [Incidents] INNER JOIN [Technicians]
                ON [Incidents.TechID] EQUALS [Technicians.TechID]
            INNER JOIN [Products]
                ON [Incidents.ProductCode] EQUALS [Products.ProductCode]
            WHERE ([CustomerID] = @CustomerID)
            ORDER BY [ProductCode]">
   

Search multiple document library in Query

  

How to search multiple document library in a sitecollection. these document library has same named : DocLib1, DocLib2, DocLib3 ... they all in a same sitecollection.

How to search document via FullTextSqlQuery or other Search Objects?

If there is another sitecollection structured similiary with this one, how to search all these document library? Can we search all sites documents then use url for filter ?

Thanks a lot.

 


merging multiple tables in a single dataset to single table

  

 i have a stored procedure which returns three tables to a dataset ..... now i need to merge all three tables to a single table from d same dataset 


like dataset1 has table1 table2 and table3 .... i want all the three tabels to be merged into dataset1 itself .... instead of three diffrent tables so that i can show all three table data in a single datagrid  as a compact data and combination of 3 tables from d single dataset.....



can some1 help me please.....


search multiple words into textbox and populate all records in gridview related those keywords

  

I have a textbox and a gridview which is bound to a table

what I want to achieve is a solution where lets say there are two records - e.g. "1. Book and 2. Red", i want a user to type in those words and the gridview shows the results as followed;

1. Book

2. Red

I have set up the sql data source and everything and my like operator is this...

LIKE '%' + @record + '%'

how can I solve this problem?


Filter search over multiple text columns

  

Hi everyone,

I'm working on a library that stores information on various cases. The case table has several columns that contain descriptive strings on what happened in the case. I would like to create a single filter that returns all cases where the search string is found in any of the columns. I've looked at Dynamic Data Filtering, but as far as I can tell, the "Contains" filter only allows you to connect to each column individually. Has anyone tried this?

Thanks,

Andrew


LINQ query with multiple joins, problem

  

I am using a LINQ query with multiple joins, the last join does not return any values even though values exist in the database. Below is my code.

when the query returns suiteNameTrg and SuiteTypeTrg are empty, all other values are returned correctly.

string suiteNameTrg = string.Empty;
            string suiteTypeTrg = string.Empty;
            using (DataClassesDataContext db = new DataClassesDataContext())
            {  
                    var productQuery = from assets in db.ASSETs
                    join relocatableUnits in db.RELOCATABLE_UNITs on assets.RUID equals relocatableUnits.RUID into assets_units
                    from relocatableUnits in assets_units.DefaultIfEmpty()
                   join build in db.BUILDINGs on assets.BUILDING_ID equals build.BUILDING_ID into assets_bins
                   from build in assets_bins.DefaultIfEmpty()
                   join test in db.TEST_SUITEs on assets.TEST_SUITE_ID equals test.TEST_SUITE_ID into test_bins
                   from test in test_bins.DefaultIfEmpty()
                    
                    join testTrgt in db.TEST_SUITEs on assets.TARGET_TEST_SUITE_ID equals testTrgt.TEST_SUITE_ID into testTrgt_bins
                    from testTrgt in testTrgt_bins.DefaultIfEmpty()

                    select new
                                   {
                          

FAST search query is slow...

  
Hi, we are using fast search for sharepoint 2010. We are crawling an external data source and this is used for search queries. we have around 30 metadata properties and all are full-text indexed. however, the search operation is slow for a database of 5k records in intranet (webserver and database server are in different geographic regions). typically a 100 item search takes 9-10 sec. it get worse over internet and the search query varies from 10-45 sec for 100 items. Any pointers will be helpful. thanks.  

DateTime custom managed property search fails with " Your query is malformed. Please rephrase your q

  
I've created a front end search page in Silverlight 4 for SharePoint Search.  Currently we are using WSS 3.0 + Search Server Express 2008 (v 12.0.0.6421).  The page interacts with the MOSS version of the search web service at:   <site collection>/_vti_bin/search.asmx The reason for this approach is the unique way the requirements specify the look and behavior of the results.  The built-in Search Center page or web parts will not satisfy these requirements. We are going into production but I still cannot figure out how to search against my custom managed properties that are of Type DateTime.  If I cannot get this to work, it is a showstopper. I've tried numerous variations on the SQL Syntax and cannot get it to work.  I know the error is in the date portion of the WHERE clause since I can remove it and searches work fine. Here is a working query: SELECT Size, Rank, Path, Title, Description, Write, RequestSubmittedDate, DocumentType, RequestPromisedDate, ProblemDescription, DatePublished, RequestOwner, RequestingDepartment, DocumentAuthor, ProjectNumber, ProjectDescription, RequestStatus FROM scope() WHERE CONTAINS ('"nmr"') ORDER BY "Rank" DESC yet if I try to use a date literal in the WHERE clause as in the following query modification, I get the "malformed"

SUM col from multiple tables

  
I am trying to SUM a column from each of 3 tables, where an ID field is the same in each table and the date range is the same also It would look something like this: table1      table2      table3      table4  amt         amt         amt         t4ID  ID           ID           ID  date        date        date SELECT SUM(t1.amt),SUM(t2.amt),SUM(t3.amt) WHERE (each table).ID = @t4ID AND (each table).date BETWEEN @date1 AND @date2 the t4ID, date1 and date2 will be chosen by the user from controls and supplied to the statement via a parameter array. I have tried many variations ( with more to go) to send 1 @t4ID parameter, for example, and use that in all 3 tables (same with the dates). Any help to nudge me in the right direction would be appreciated. Thanks

Running a single SQL update query on multiple foxpro databases

  
Hi, Env : SSIS 2008 My requirement is to run a update SQL statement on multiple foxpro databases. The fox database paths are available in a SQL server table.  I've created a for each loop control and assigned the database path to a variable named dbpath. Within the loop, I added an "execute sql task" control. Now what properties are to be set to get the requirement done. Appreciate any help. Regards. BH  Please click "Mark as Answer" if this resolves your problem or "Vote as Helpful" if you find it helpful. BH

Search query returning 0 results

  
I'm using a query which returns 0 results but was working some weeks ago.  I checked the code and nothing has changed since then.  I created a Search Center Site on another port and using the same terms I get many results there.  I checked my scopes and they are all right. Nothing changed there either. Could someone help me figure out what may be the problem in my query.  Or maybe it's my Scopes/Content Sources configuration. SELECT URL, FileName, Title, Description, Rank, Size, HitHighlightedSummary, Path FROM SCOPE() WHERE freetext(defaultproperties, ' +légumes')  AND ( "scope" = 'Scope - My Portal - All Site - fr'  )    ORDER BY Rank DESCDaniel Siconnelli There is neither good nor evil... only mogwais and gremlins

Need help to search for extra space in all tables.

  
Hi, I try to search for data which has some extra spaces in ALL TABLES. Does any one know if there a tool that can do that or the scripts can return all the data (see desire results below). Thank you in advance.  SQL2008. IF OBJECT_ID('Tempdb.dbo.#T1', 'u') IS NOT NULL   DROP TABLE #T1 GO CREATE TABLE #T1 (   FullName   VARCHAR(30) ) GO INSERT INTO #T1 VALUES ('Joe  Smith') INSERT INTO #T1 VALUES ('April Smith ') INSERT INTO #T1 VALUES ('Peter Chen') INSERT INTO #T1 VALUES ('Kristine Nguyen') GO IF OBJECT_ID('Tempdb.dbo.#T2', 'u') IS NOT NULL   DROP TABLE #T2 GO CREATE TABLE #T2 (   FullName   VARCHAR(30) ) GO INSERT INTO #T2 VALUES (' John Smith') INSERT INTO #T2 VALUES ('Lisa Tran ') INSERT INTO #T2 VALUES ('Nicole  Ngo') INSERT INTO #T2 VALUES ('Brandon Lee') GO    SELECT *      FROM #T1;    GO       SELECT *      FROM #T2;    GO -- Desire results. FullName         TableName ---------------- --------- Joe  Smith       #T1   (2 spaces in between) April Smith      #T1   (space after Smith)  John Smith      #T2   (space in front) Lisa Tran  &
Categories: 
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