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 2008 Forums
 Transact-SQL (2008)
 comparison of two column in a table

Author  Topic 

Yonkouturko
Yak Posting Veteran

59 Posts

Posted - 2012-12-06 : 09:02:58
is it possible for 2 columns in database to be compared directly??
need your comments on these matter
please be good to me im just a newbie thanks in advance!

SELECT ProductID, Barcode, Category, ProductName, Unit, Quantity, AmountPerUnit, UnitCeiling, UnitFlooring
FROM Table_Product
WHERE (ProductName LIKE '%' + @SEARCH + '%') AND (Quantity <= UnitFlooring)

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-12-06 : 09:21:13
If you are referring to the AND (Quantity <= UnitFlooring), assuming that they are compatible data types in the same table, you CAN do that.
Go to Top of Page

Yonkouturko
Yak Posting Veteran

59 Posts

Posted - 2012-12-06 : 09:23:55
@sunitabeck

ohmygash

my post is not clear though... yes im referring to that line of code... tnx for the reply ..!!!
Go to Top of Page
   

- Advertisement -