-1

I have the following table structure:

Column1     Column2   Column3
Value1.1    Value2.1   data1
Value1.2    Value2.2   data2

I want use my column1 data as a filter condition column. How can I write a t-sql query with the following filter conditions :

where Value1.1 = Value2.1

will bring me data1

Jean
  • 524
  • 4
  • 21
  • I'm not sure I understand your example. Are you looking for Column1 to equal Column2 or for Column to equal a value regardless if it exist in column2? – jradich1234 Mar 15 '16 at 17:46
  • Do you want to compare the last two characters on Column1 and Column2? – Balde Mar 15 '16 at 17:54
  • Unfortunately, I don't understand the question. But maybe the following website will be able to shed some light on the WHERE clause: http://www.w3schools.com/sql/sql_where.asp There is even a `Try it yourself` button where you can experiment a bit. – Ralph Mar 15 '16 at 17:54
  • Possible duplicate of [Select Rows with matching columns from SQL Server](http://stackoverflow.com/questions/15101457/select-rows-with-matching-columns-from-sql-server) – Jean Mar 15 '16 at 21:41

2 Answers2

0

Not sure what you mean. Is this what you are asking for ?

select Column3
from the_table
where col1 = col2
HelloWorldNoMore
  • 307
  • 3
  • 14
0

Try this:

SELECT Column3 FROM YourTable WHERE Column1 = Value2.1

or you can replace the Value2.1 with your column name if you want to retrieve the filter result which Column1 has the same value with Column2 like this:

SELECT Column3 FROM YourTable WHERE Column1 = Column2
Sirin
  • 11
  • 1