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

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Issue with one of simple query

Posted By:      Posted Date: September 14, 2010    Points: 0   Category :Sql Server
Hi team, I have a issue in the one of my query select   * from Prod3 where pnumber in (select distinct Policy from prod3_excel) order by pnumber This query gives me 8361 records and there are 8419 records in Prod3 how can i get the remaining records in Prod3 that is 58? select * from Prod3 where pnumber not in (select distinct Policy from prod3_excel) order by pnumber why this is not working? Thanks, Eshwar

View Complete Post

More Related Resource Links

Data query task issue

Hi Someone help me undersand how to implement a Data meaning query  in SSIS project step by step. even a small package for testing this task ThanksThe complexity resides in the simplicity

Sql query inner join issue

so i have a datagridview in a vb from. my plan is to display a table named emplyees, having the following fields: [employees] ([lastname], [firstname], [cost_center], [division], [job_title], [hiring_date], [exit_date], [functional_manager], [member_of], [backup_by], [out_of_office], [desk_phone], [mobile_phone], [comments]. But I need to make an inner join with 3 other tables. job_titles, divisons and rss. How should i writethe select command for this, having the inner join forthe follwing fields: division- division.name,job_title-job_titles.name , and member_of- rss.group_name. I have no idea how to do it. pls help Thanks

Issue with CAML Query

I am having a RadGrid in Sharepoint Webpart with each row having a checkbox and multiple Columns where one of the Columns is ColumnID. When a multiple checkboxes are selected, their respective ColumnID Value is used to Query and generate report. I am using CAML Query to pass in the ColumnID of each checkbox selected and generate report based on the ColumnID Value. But I am having issue with the Query I have written. I have tried two ways: One of the ways was to Hardcode just two ColumnID Values as I was not sure how to read array of multiple columnID values. But I was wondering where I was going wrong since it was throwing following error: "Multiple with same name ColumnID were used" Telerik.Reporting.ReportParameter param1 = new Telerik.Reporting.ReportParameter(); param1.Name = "ColumnID"; param1.Type = Telerik.Reporting.ReportParameterType.Integer; param1.AllowBlank = false; param1.AllowNull = true; param1.Text = "ColumnID"; param1.Visible = true; param1.Value = "200"; this.ReportParameters.Add(param1); Telerik.Reporting.ReportParameter param2 = new Telerik.Reporting.ReportParameter(); param2.Name = "ColumnID"; param2.Type = Telerik.Reporting.ReportParameterType.Integer; param2.AllowBlank = false; param2.AllowNull = true; param2.Text = &qu

how to create a List order and unourder a simple Sql Query

A Simple Query Pass to connection String 1 My Query is SELECT a.HD, a.HEAD, a.SH, a.SUBHEAD, a.TRK, a.TRACK, a.TGT, a.TARGET, a.PDC, a.DT_RELEASE, a.STATUS, a.COFROM V_HIERARCHY1 a   2,My Data is HD    HEAD    SH    SUBHEAD    TRK    TRACK    TGT    TARGET    PDC    DT_RELEASE    STATUS    COHR    HR    Rec    Records    Leave    Leave Records    HRL.0002    Quarterly Review    01.07.2010    04.07.2010    Planned    EdlinkHR    HR1    DB    Database    SAL    Salary    DDS.0001    Calculation of Monthly salary    08.08.2010    09.08.2010    WIP    EdlinkHR    HR    Rec    Records    Ind    Induction Records    HRI.0001    Completion of dossiers.    08.07.2010    10.07.2010    WIP    EdlinkHR    HR  

how to generate an Xml pass Simple query structure like

1. My sql query is        SELECT a.HD, a.HEAD, a.SH, a.SUBHEAD, a.TRK, a.TRACK, a.TGT, a.TARGET, a.PDC, a.DT_RELEASE, a.STATUS, a.COFROM V_HIERARCHY1 a2, My Data is HR    HR    Rec    Records    Leave    Leave Records    HRL.0001    Policy and Process for leave record.    27.06.2010    30.06.2010    WIP    EdlinkHR    HR    Rec    Records    Leave    Leave Records    HRL.0002    Quarterly Review    01.07.2010    04.07.2010    Planned    EdlinkHR    HR    DB    Database    SAL    Salary    DDS.0001    Calculation of Monthly salary    08.08.2010    09.08.2010    WIP    EdlinkHR    HR    Rec    Records    Ind    Induction Records    HRI.0001    Completion of dossiers.    08.07.2010    10.07.2010    WIP   &nbs

SQL query issue

Hi, I have a question that is pricking me as to how to solve it? Here is my requirement and table structures: create table #docs ( docid int, setupid int, docfname varchar(20), docmname varchar(20), doclname varchar(20), ) create table #setups ( docid int, setupid int ) -- A single doc can have multiple setups insert into #docs select 1, 100, 'Spock', 'Moreau', 'Livingston' union select 2, 101, 'Demento', 'Dolittle', 'Kevorkian' union select 3, 103, 'Faust', 'Zhivago', 'Jekyll' union select 4, 104, 'Freud', 'Laura', 'Phil' insert into #setups select 1, 200 union select 1, 300 union select 2, 200 union select 2, 400 union select 4, 200 union select 4, 500 /* If the doc has multiple setups I would like to copy over the data for the all the setupids as below */ select * from #docs select * from #setups drop table #docs drop table #setups I am trying to get this result using union and left out join etc., using a query and not using cursors/loops. Please help me and thanks for the responses. docid setupid docfname docmname doclname 1 100 Spock Moreau Livingston 1 200 Spock Moreau Livingston  --- data copied over 1 300 Spock Moreau Livingston  --- data copied over 2 101 Demento Dolittle Kevorkian 2 200 Demento Dolittle Kevorkian    --- data copied over 2 400 Demento Dolittle&n

need a simple query

Hi All, I have a table with multiple rows but I want to select identical rows where createdon (datetime) date is less than one minute different for instance 1 - 299  - 1/9/2010 - 13:30:00 1 - 299  - 1/9/2010 - 13:30:14 Thanks  

Help to write very simple query...


How I can write this query ?

I have value = 1000

I wont to get all value from table [MHGROUP].CUSTOM2

from column CPARENT_ALIAS

all values which beginning with num 1000.



cmd2 = new SqlCommand("SELECT * FROM [MHGROUP].CUSTOM2 WHERE CPARENT_ALIAS ='" + value + "'", con2

Simple WPF ListView Binding Issue


I've uploaded a very simple test project with the issue here: http://www.2shared.com/file/sRVEBh42/KvpTest.html (or here)


The basic problem is, I have a ListView bound to a property on my class. The property is of type ObservableCollection<ObservableKeyValuePair<string, string>>.

I created the ObservableKeyValuePair so I can do two-way binding.


My ListView has 2 columns, Key, and Value. The Value column has a custom DataTemplate which is simply a TextBox, with its Text property setup with a two-way binding (so the user can edit the values of the ObservableCollection<ObservableKeyValuePair<string, string>>.

In my property's setter, I place a breakpoint however it never gets it. The setter of the ObservableKeyValuePair<string, string> is getting hit instead. This seems right, but I need to also propagate that change to the class property my ListView is bound to so I can simply pass the property through to another class and it would contain the changes.

Any ideas how I can achieve this? The sample project is very simple and small if you don't mind downloading it.



simple query


I need maximum mark scored each students and min mark scored each students.

I have done this way...

select ID,max(mark),min(mark) from table1 group by ID

But i need more field as Class.... I dont want include class field in group by clause


Another Issue with CAML Query



I know this question has to be put in Telerik Forums but its something related to CAML and data being bound programmatically. So, please take a minute to share your thoughts on my issue. Thanks.

In my previous post here , I had issue with CAML Query, which works great now. So, here is one of my issue related to it: I am using a Report which has Subreport. So, I have set the datasource of Main Report to be a DataTable that holds the CAML Query (the result CAML Query from previous post here ). Now, for the same parameter values, for each Report, I want its subsequent subreport to be be populate programmatically. But, this CAML Query do

Parallel plan for simple query ! Any solutions


I am getting a parallel plan for a simple query below. Any workarounds

	UPDATE tblProfile
	SET PlanName = NULL, PlanValue =NULL
	FROM tblProfile pfl
	INNER JOIN tblCustomerPlan ts 
		ON pfl.planID = ts.planID
	WHERE (ts.Name = 'VOID' OR ts.Name = 'IPDC')
	AND ProfileURN = @ProfileURN 

Issue with CAML Query regarding date comparision.

I have a below query in one the eventhandlers. All I do in the query is to get all records where Next_Date column is < CurrentDateTime ( I have shown current date below in full date format but it will be variable).

What I am observing is the comparision seems to be failing or not considering time format. For example the below query should not return any records when NEXT_DATE is 9/30/2010 23:59:59 and CurrentDateTime is 9/30/2010 06:22:22. However the query does return records. It looks like the comparision is just happening with Date and not time. What could be the problem? Please suggest.

         <FieldRef Name='Next_x0020_Date' />
         <Value Type='DateTime'>2010-09-30T13:13:13Z</Value>
      <FieldRef Name='Next_x0020_Date' Ascending='False' />

simple query


Hi Team,

I am always confused with one simple query

i have get the data which is not in a table B

select *from TableA where col1 in (select col1 from TableB)

how to get the data in tableA which is not in TableB

select *from TableA where col1 not in (select col1 from TableB) why this is not working?



Query String Issue


Hello everyone,

I just started with learning MVC so please bear with me. I have a grid displayed on my Main page(Index) and when I click on the Details Link for a particular row(suppose productID=1) it should invoke the following action otherwise redirectToAction("Index"):


        // GET: /Home/Details
        public ActionResult Details(int? ProductID)
            if (!ProductID.HasValue)
                return RedirectToAction("Index");
                return View("Details");

The ProductID in my case is always Null and it actually ends up redirecting back to the main page as expected. Why is that happening. Somebody please help.

Thank You

Simple query on a table just hangs ...

We have a table that contains parameters for our DW jobs. I can do a "SELECT *" from this table which works fine. However, when we right click and view the "Top n" rows, the interface just hangs with a message "Executing Query. Waiting for response from data source". We have run a DBCC CHECKTABLE command on that table and it ran fine. Any ideas what the issue may be? We have even restarted the SQL Server (2008) and to no effect. We use the "Top n" interface to easily update parameters to run our jobs. Appreciate any help / feedback.
Jagannathan Santhanam

REST Query Batch Issue


Hi All,

I've got an issue when querying the listdata.svc from a Silverlight client.   

I construct the query as follows:

var parametersQuery = context.Parameters.Expand("AssociatedTask") as DataServiceQuery<ParametersItem>;

If I execute the query individually and then process the results then the AssociatedTask collection gets populated, if I include it as a batch then it does not.

I've examined the query in Fiddler and as far as I can tell the request and response are identical.

Anyone shed any light on the issue?

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