SQL Script
-
Hi Guys, I have a table that contains 100 disticnt record.(Table1) I have a second table that contain 40 records(Table2). when i run a script to get me a records that are in Table1 not in Table2. Select * from Table1 where field1 not in (select field1 from Table2) I should have at least 60 records.However ,it doesnot return anything? Can you please advice? Thank you very much.
-
Hi Guys, I have a table that contains 100 disticnt record.(Table1) I have a second table that contain 40 records(Table2). when i run a script to get me a records that are in Table1 not in Table2. Select * from Table1 where field1 not in (select field1 from Table2) I should have at least 60 records.However ,it doesnot return anything? Can you please advice? Thank you very much.
-
Hi Guys, I have a table that contains 100 disticnt record.(Table1) I have a second table that contain 40 records(Table2). when i run a script to get me a records that are in Table1 not in Table2. Select * from Table1 where field1 not in (select field1 from Table2) I should have at least 60 records.However ,it doesnot return anything? Can you please advice? Thank you very much.
and where does this happens: in code or in database if it is in code try running it in some plsql developer and see what you get
-
Many thanks for your reply.Its Much appreciated Table1 id int Cli Nvarchar(200) Timestamp datetime 100 records Table2 id int Cli nvarchar(200) 40 records Select distinct(cli) from Table1 where Cli not in (select Cli from table2) This should at least return 60 records. Regards Select
-
and where does this happens: in code or in database if it is in code try running it in some plsql developer and see what you get
-
Select distinct(cli) from Table1 where cli not in (select Cli from table2) try this with small c in second cli :)
-
Select distinct(cli) from Table1 where cli not in (select Cli from table2) try this with small c in second cli :)
-
Many thanks for your reply.Its Much appreciated Table1 id int Cli Nvarchar(200) Timestamp datetime 100 records Table2 id int Cli nvarchar(200) 40 records Select distinct(cli) from Table1 where Cli not in (select Cli from table2) This should at least return 60 records. Regards Select
-
Hi Guys, I have a table that contains 100 disticnt record.(Table1) I have a second table that contain 40 records(Table2). when i run a script to get me a records that are in Table1 not in Table2. Select * from Table1 where field1 not in (select field1 from Table2) I should have at least 60 records.However ,it doesnot return anything? Can you please advice? Thank you very much.
This is a SQL question. I would suggest you break it down to try to work out why it doesn't work.
Christian Graus Driven to the arms of OSX by Vista. "I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
-
Have you got nulls in your fields? That would cause it.
Bob Ashfield Consultants Ltd Proud to be a 2009 Code Project MVP
-
This is a SQL question. I would suggest you break it down to try to work out why it doesn't work.
Christian Graus Driven to the arms of OSX by Vista. "I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
-
This is a SQL question. I would suggest you break it down to try to work out why it doesn't work.
Christian Graus Driven to the arms of OSX by Vista. "I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
-
Hi Christian, Can you help me with a script on how to check and remove any Null script from a table. Many thanks
-
Many thanks for your reply.Its Much appreciated Table1 id int Cli Nvarchar(200) Timestamp datetime 100 records Table2 id int Cli nvarchar(200) 40 records Select distinct(cli) from Table1 where Cli not in (select Cli from table2) This should at least return 60 records. Regards Select
<blockquote class="FQ"><div class="FQA">kibromg wrote:</div>Select distinct(cli) from Table1 where Cli not in (select Cli from table2)</blockquote> Select distinct(cli) from Table1 where Cli not in (select Cli from table2 where Cli is not null) FTFY, SQL server has some floopy processing when it does 'not in' queries.
The true man wants two things: danger and play. For that reason he wants woman, as the most dangerous plaything.
-
Yes Please.when i select distinct(cli) there is one record NULL. When i try to remove it delete from Table1 where cli like NULL it does nothing. Can you please advice how can i remove it?