Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
scelamko
Constraint Violating Yak Guru
309 Posts |
Posted - 2006-01-30 : 14:18:53
|
| Guys,I have the following queries, I confused/puzzled at to why last query returns 0 rowsselect * from nplats--- 12811select book, page1, book+page1 from nplatswhere ltrim(rtrim(book))+ltrim(rtrim(page1)) in (select ltrim(rtrim(book))+ltrim(rtrim(page)) from document)order by book--- 2693select book, page1, book+page1 from nplatswhere ltrim(rtrim(book))+ltrim(rtrim(page1)) not in (select ltrim(rtrim(book))+ltrim(rtrim(page)) from document)order by book--- 0I have 12811 rows in the table nplats, When I use 1st query I get 2693. Technically 2nd query should give me 10118 (12811 - 2693) rows, on the contrary it gives me 0 rows. I dont know what mistake I am doing here. All colums (book, page, page1) across both the tables have same datatype varchar(10).Any suggestions/inputs would be helpfulThanks |
|
|
Arnold Fribble
Yak-finder General
1961 Posts |
Posted - 2006-01-30 : 14:31:31
|
| There's a NULL in document.book or document.page somewhere. |
 |
|
|
scelamko
Constraint Violating Yak Guru
309 Posts |
Posted - 2006-01-30 : 15:13:43
|
| Yepp you are right, thanks a ton |
 |
|
|
|
|
|