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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 finding overwrite name (compare 2 tab)

Author  Topic 

Gekko
Yak Posting Veteran

63 Posts

Posted - 2011-06-10 : 14:17:09
Hallo !

Please a need help.
TabProduct: I have list (register) products.
Tsale: I have sale this products.
Sometimes happens that in Tabproduct overwrite Name.
I want to choose (select) from which the Tproducts has been rewritten.
example:

Tproduct
Numpr.....Grouppr......Name
124-------6------------keywords
132-------4------------mouse
124-------2------------monitor(overwrite on "notebok" this minute)
124-------3------------usb


Tsale
invoice.....Numpr.....Grouppr......name
0001---------124-------6---------keywords
0001---------132-------4---------mouse
0002---------124-------2---------monitor
0002---------124-------3---------usb

and now (this minute) I run a SQL query where I'll find a product that has been rewritten in the product table (compare this two table), but select condition is
Tsale.name <> Tproduct.name

result:

Numpr.....Grouppr......Name.......OverwriteProdukt
124---------2--------monitor--------notebok


big thanks


sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2011-06-10 : 14:46:42
You probably would need to enhance your where clause like this:

WHERE
Tsale.name <> Tproduct.name
AND Tsale.Numpr = Tproduct.Numpr
AND Tsale.Grouppr = Tproduct.Grouppr
Go to Top of Page

Gekko
Yak Posting Veteran

63 Posts

Posted - 2011-06-10 : 16:36:31
but of course that simple....
it works ....

thanks sunitabeck
Go to Top of Page
   

- Advertisement -