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


Top 5 Contributors of the Month
sivanagamahesh
Post New Web Links

how to select the record when their is no record on the other table

Posted By:      Posted Date: November 20, 2010    Points: 0   Category :Sql Server
 

Hi all,

 i am working on migration project  i have to select the record from one table which is not prescent in other depending on the condition

for example i have two table one is master table & other is transaction Table 

structure of master table is as follows

Sb_Type      Sb_acno            name                 Id -------------------------------------

 N              na/0005               aaa                   12 -------------------------------

M               Mb/0002              bbb                   15 -------------------------------------

--                  ----                   --     &nbs


View Complete Post


More Related Resource Links

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  

How to select bottom record if there is no id in table.

  
Hi All, I am trying to select the bottom record but there is no id in table. For Example A              B jo             john so             som mo            mon to              tom go              gone

Problem Select ancestors a Record

  
Hi; I have a table by three columns ("ID","Title","ParentID"),me want to select ancestors a Record by "ID" identifier. example: ID      Title       ParentID 1         Library       null 2         Section1      1 3        Section2       1 4        1.1              2   for example if record 4 selected return records by "ID" identifier 2,1 How can me do it?  

Delete Record From Table A that Is Not In Table B

  
I have two tables; Table A id, name 101, jones 102, smith 103, williams 104, johnson 105, brown 106, green 107, anderson   Table B id, name, city, state 101, jones, des moine, Idaho 103, williams, Corvallis, Oregon 104, johnson, Grand Forks, North Dakota 105, brown, Phoenix, Arizona 107, anderson, New York, New York   I need to delete records from Table A that are not in Table B.  My front end is writen in .net and I am using Data Access Layer along with a Business Logic Layer for data interaction.   I have tried at least seven variations of joining, right outer join, left outer join resulting in wiping our the entire table or nothing at all; not to mention deleting the record that ought to remain and keeping the record that needs to be deleted!   In my BLL I tried to capture the rowsAffected for the deletion by using-without success. Dim rowsAffected As Integer = Adapter.ID_Deletion(ID) If rowsAffected = 1 Then Exit Function Else Return rowsAffected = 1 End If   Please help.   MsMe.

How to send record(which is a weblink) from a table to the value of the variable in SSIS package and

  
Hi Folks, I have table called Table1 with columns, col1 and col2 with col1 having weblinks for the report and col2 the name of the report. Now, i have a package with a variables var1 and var2 which should get the col1 and col2 values respectively from table1 and send it through an email. if the weblink gets updated in the table, package should send the updated link. i know the reverse way of it but trying to do somethig like this. Appreciate any help from you guys. Thanks

Record is already exists in Dimension table but still Kimball SCD Component is Identifying it as a n

  
Hi I have loaded Dimension table. Now even if the record already exists in my dimension table , every time I run package Kimball method SCD component is identifying as a new record. Please advise. Thanks, Anuja

Cannot add record in table using NHibernate

  
Hi there!I'm new to NHibernate and I need help on this issue.No records where inserted in my SQL Table after committing the transaction or after the .Flush() method. I checked the code and it follows the correct sequence of codes. I can't seem to find any other way where the error fails.

select the record with the lowest datediff()

  
Hello, I am trying to figure this out and can't quite get it. I have a subselect in my select that can of course only return one row. In some cases it will return more than one, to filter out the other rows we are going to only return the row with the least amount of days between 2 dates. I got it work as shown below but I hope that there is a better way to do this. select CreatedDate, ConfirmedDlv, inventtransid, min(DATEDIFF(DAY,CreatedDate, ConfirmedDlv)) from SalesLine where projId = '005124' and ItemId = '105732' and dataareaid = 'dfg' group by CreatedDate, ConfirmedDlv, inventtransid having min(DATEDIFF(DAY,CreatedDate, ConfirmedDlv)) = ( select min(DATEDIFF(DAY,CreatedDate, ConfirmedDlv)) from SalesLine where projId = '005124' and ItemId = '105732' and dataareaid = 'dfg' ) Anyone have any tips?   Thanks

Select updated record after edit

  
Hello!On one (aspx) page I have a GridView (GridView has multiple pages). After a user selects a row/record and clicks "edit" he's redirected to another (.aspx) page where he edits the selected record via DetailsView. After clicking update on DetailsView he's redirected back to the page containing the GridView.What is the simplest/shortest way that the updated record is automatically selected on the Gridview (e.g. at Page_Load event)?Thx in advance!M

how can insert only new record into another table through trigger

  
I have on master table in sql in which every time new data is inserted.i just want to copy the new inserted record into another table.How can i do this. below is my trigger but how can it identify only new records should be inserted into second table.please help me and modify it. CREATE TRIGGER CopyRecordToPortInTable ON SmsTable AFTER INSERT AS BEGIN SET NOCOUNT ON; insert into Portintable(smsno,smstext,flag) select (sms,smstext,0) where condition END

Update a record in a table?

  
HiI've been playing around with MVC lately, and was wondering how you could do this:I have a view that displays a list of products, and against each product is a list of categories (in a combobox). I'm trying to find out how you can update a product's category when you select a category in the list. I know you could do something fairly simple with jQuery, but I'm trying to understand how submitting forms works with MVC.Here's what I currently have:// Controller public ActionResult Index() { List<Product> products = _productRepository.GetProducts(); List<ProductCategory> categories = _productRepository.GetCategories(); ProductsViewModel viewModel = new ProductsViewModel { Products = products, ProductCategories = new SelectList(categories, "Id", "Description") }; return View(viewModel); } // ViewModel public class ProductsViewModel { public List<Product> Products { get; set; } public SelectList ProductCategories { get; set; } } // View <% using (Html.BeginForm()) { %> <table> <tr> <th>Id</th> <th>Description</th> <th>Category</th> </tr> <% foreach (var product in Model.Products) { %> <tr> <td><%: product.Id%></td> <td><%:

Possible to send an email if a record is added to a table?

  
I would like to be able to send an email notification if a website user inserts a new record in a table.  This will be a relatively rare occurrence so it would be very useful to have the notification as opposed to having my users check my summary page that lists all the IDs that have a record in this table. I googled but I must not be hitting on the right keywords or phrase to find the answer to this question. Thanks in advance for 1) letting me know if this is possible (I'm version ASP.NET 2.0 and using VB with a SQL Server database) and/or 2) pointing me in the right direction to find out how to do it if it is possible. Thanks! 

Delete one table record if the no more record are associated from another table

  
Hello All,   In my scenario I have two tables say Table A and Table B. Table A has 3 records   Id Name Value 1 ABC 123 2 XYZ 456 3 PQR 789   Now in another table I have 4 records   Id FName Lname TableAID 101 ABC XYZ 1 102 AAA BBB 1 103 XXX YYY 1 104 PPP QQQ 2   Now I display table B records in gridview when I select 3 records say id 101,102,103 and click on delete button. Table B selected records should be deleted and its working fine.   The problem is that in Table A record 1 ABC 123 is only associated with that many records so when I delete that record from Table B at that time the associated record in Table A should also be deleted as no more association with that record in Table B.   So please give me query or appropriate solution for that.  

How to copy a table record and all related table records linked via relationships...

  
Hi!I'm using SQL Server 2005 in a project, and i need to duplicate a record from a table and all it's relationships. Can this be done? If so, can anyone tel me how please.

DataBase maximum table record count

  

Hello Friends,

My requirement is, we have more than 5 database servers, each server lot of databases, each database lot of tables.

 I want show the details

---------------------------------------------------------------

ServerName: abcServer

DatabaseName: xyzDatabase

MaximumRecordsTableName: empTable

-----------------------------------------------------------------

In asp or Classic asp.

please anybody help for code and query.

and

how to split the connection string in asp ?






What is causing oracle datbase table failing to save inserted Record permenantly?

  

I have a table in orcale database where I am inserting records. I am able to insert a record in a table but it is not being saved permenantly.When inserting there is no error. what could be causing this?


How to select a master record plus related custom fields in the same row?

  

Consider this table of master records:

project_id  project_name

1               Important Project

2               More Important Project

etc...

My application allows users to create an arbitrary number of custom fields for projects. Here is the table of custom field values:

custom_field_value_id   project_id   custom_field_name   custom_field_value

1                                  1               Project Manager        Jim Smith

2                                  1               Due Date                  12-31-2010

3       &

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