March 17, 2008 at 4:13 pm
hai,
one more ques
suppose u have two tables
in first table 15 rows and in the second table 10 rows
there is a col named ID which is common to both the tables and some of the values in this col are common
now u hav to write a querry which gives the values of rows which r not common to both tables
March 17, 2008 at 6:29 pm
FULL OUTER JOIN with null detectors on both tables.
--Jeff Moden
Change is inevitable... Change for the better is not.
March 18, 2008 at 10:05 am
thank u jeff
can u provide me the script
March 18, 2008 at 10:14 am
If we did that, you might think it was easy! Have a go at writing it yourself, and post back if there's any particular aspect you don't understand.
John
March 18, 2008 at 10:25 am
Use Books Online to get an example. How can we write you a query if we don't know your table schema? Anything else would be an example derived from the authors head. Why not save everyone time and use BOL to get a working example from a Microsoft test DB where you can at least play with it and get to understand how it works?
March 18, 2008 at 11:32 am
swathichilukuri85 (3/18/2008)
thank u jeffcan u provide me the script
The others are correct... We can't write a script for your tables because you haven't posted them or any sample data. Please click on the URL in my signature line for more information on that. Do read the article and try the code... it will be a great help to you in future postings...
Also, Books Online is, or should be, your best friend for stuff like this. If you look in the index for FULL OUTER JOIN, you'll find the following URL (past it into the URL field of the Books Online screen) ... and it has examples using the Adventure Works database that comes with SQL Server...
ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/udb9/html/58855df5-6620-479d-b662-611e94ce8e2b.htm
--Jeff Moden
Change is inevitable... Change for the better is not.
March 18, 2008 at 11:52 am
thank u all
i got it solved
March 18, 2008 at 3:06 pm
Perfect... the next thing to do would be to practice a little of what we call "forum etiquette"... 😉 How did you solve it and would you mind posting the code, please?
--Jeff Moden
Change is inevitable... Change for the better is not.
March 20, 2008 at 11:12 am
sorry it was late to get back with the solution
but here is it
use <database name?
go
-- The OUTER keyword following the FULL keyword is optional.
SELECT p.Name, sod.SalesOrderID
FROM Production.Product p
FULL OUTER JOIN Sales.SalesOrderDetail sod
ON p.ProductID = sod.ProductID
WHERE p.ProductID IS NULL
OR sod.ProductID IS NULL
ORDER BY p.Name ;
the column names are my table regarding so u can change them accordingly
once again thanks everybody
March 20, 2008 at 3:42 pm
Thanks...
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 10 posts - 1 through 9 (of 9 total)
You must be logged in to reply to this topic. Login to reply