MegaPowerRockstar Posted May 22, 2014 Report Posted May 22, 2014 Hi, Need Help with writing a query. Probably beest approach.... I have lookup table, name it as table1 as below: Id tbl1_Col1 tb1_Col2 1 12.345 31.097 2 19.876 38.123 3 23.321 41.961 I have another table, name it as table 2 as below: Id Name Address City tbl2_col1 tbl2_col2 1 John 12 Key St Honolulu 15.234 32.135 2 Wilson 31 Poni St Edward 21.345 39.987 3 tom 29 Vinerd james 26.916 45.131 Now my situation is, for every record in table 2, i need to compare all the rows of lookup table with formula. i need to compare columns with tbl2_col1 with tbl1_col1 and tbl2_col2 with tbl1_col2. Can anyone please help me out......
Suhaas Posted May 22, 2014 Report Posted May 22, 2014 bhayya question koncham clear cheppu... rendu tables ila unnayi anuko.....nuvvu cheppina dani prakaram...result set emi undali post cheyyi. Id tbl1_Col1 tb1_Col2 1 12.345 31.097 2 19.876 38.123 3 23.321 41.961 4. 31.111 26.211 5. 52.232 32.323 6. 21.211 45.553 I have another table, name it as table 2 as below: Id Name Address City tbl2_col1 tbl2_col2 1 John 12 Key St Honolulu 15.234 32.135 2 Wilson 31 Poni St Edward 21.345 39.987 3 tom 29 Vinerd james 26.916 45.131 5. sam 43 Main Maui 21.211 45.553 6. ham 53 Main Maui 52.232 32.323 7. pam 63 Main Maui 11.111 22.222
amsuraj Posted May 22, 2014 Report Posted May 22, 2014 Hi, Need Help with writing a query. Probably beest approach.... I have lookup table, name it as table1 as below: Id tbl1_Col1 tb1_Col2 1 12.345 31.097 2 19.876 38.123 3 23.321 41.961 I have another table, name it as table 2 as below: Id Name Address City tbl2_col1 tbl2_col2 1 John 12 Key St Honolulu 15.234 32.135 2 Wilson 31 Poni St Edward 21.345 39.987 3 tom 29 Vinerd james 26.916 45.131 Now my situation is, for every record in table 2, i need to compare all the rows of lookup table with formula. i need to compare columns with tbl2_col1 with tbl1_col1 and tbl2_col2 with tbl1_col2. Can anyone please help me out...... Do you want matching records???// Be clear
amsuraj Posted May 22, 2014 Report Posted May 22, 2014 Hi, Need Help with writing a query. Probably beest approach.... I have lookup table, name it as table1 as below: Id tbl1_Col1 tb1_Col2 1 12.345 31.097 2 19.876 38.123 3 23.321 41.961 I have another table, name it as table 2 as below: Id Name Address City tbl2_col1 tbl2_col2 1 John 12 Key St Honolulu 15.234 32.135 2 Wilson 31 Poni St Edward 21.345 39.987 3 tom 29 Vinerd james 26.916 45.131 Now my situation is, for every record in table 2, i need to compare all the rows of lookup table with formula. i need to compare columns with tbl2_col1 with tbl1_col1 and tbl2_col2 with tbl1_col2. Can anyone please help me out......
goodlife Posted May 22, 2014 Report Posted May 22, 2014 If ID is your PK, then just join on tbl1.id = tbl2.id #/{-
cherlapalli_jailer Posted May 22, 2014 Report Posted May 22, 2014 select a,* from table1 a , table2 b where a,col1=b.col1 and/or a.col2 = b.col2
goodlife Posted May 22, 2014 Report Posted May 22, 2014 select a.*, b.*, case when a.c1 [operator | condition] b.c1 then end as result from table1 a full outer join table2 b on a.id = b.id
Suhaas Posted May 22, 2014 Report Posted May 22, 2014 select a,* from table1 a , table2 b where a,col1=b.col1 and/or a.col2 = b.col2 Deenitho duplicate rows vasthayi kada..resultset lo..
cherlapalli_jailer Posted May 22, 2014 Report Posted May 22, 2014 Deenitho duplicate rows vasthayi kada..resultset lo.. goodlife cheppindi try cheyyandi poni
cherlapalli_jailer Posted May 22, 2014 Report Posted May 22, 2014 @TS Solution edi implement chesavo ikkada update cheyyi paivi pani cheyyaka pothe ILOVEINDIA ki PM cheyyi Ee taadu
Suhaas Posted May 22, 2014 Report Posted May 22, 2014 @TS Solution edi implement chesavo ikkada update cheyyi paivi pani cheyyaka pothe ILOVEINDIA ki PM cheyyi Ee taadu +1
150bryant Posted May 22, 2014 Report Posted May 22, 2014 SELECT A.ID as A_ID, B.ID as B_ID, A.tb1_col1 as ACol1, B.tb1_col1 as BCol1 A.tb2_col2 as ACol2, B.tb2_col2 as BCol2 from TABLE1 A, TABLE2 B where A.ID = B.ID For this query you will get A_ID, B_ID, Acol1,Bcol1, Acol2,Bcol2 then you can import these into excel to compare them.. or you can compare them in the query as well.
afdbzindabad Posted May 22, 2014 Report Posted May 22, 2014 Hi, Need Help with writing a query. Probably beest approach.... I have lookup table, name it as table1 as below: Id tbl1_Col1 tb1_Col2 1 12.345 31.097 2 19.876 38.123 3 23.321 41.961 I have another table, name it as table 2 as below: Id Name Address City tbl2_col1 tbl2_col2 1 John 12 Key St Honolulu 15.234 32.135 2 Wilson 31 Poni St Edward 21.345 39.987 3 tom 29 Vinerd james 26.916 45.131 Now my situation is, for every record in table 2, i need to compare all the rows of lookup table with formula. i need to compare columns with tbl2_col1 with tbl1_col1 and tbl2_col2 with tbl1_col2. Can anyone please help me out...... Oka view create cheyyi with computed columns read it from view very fast untadi query
MegaPowerRockstar Posted May 23, 2014 Author Report Posted May 23, 2014 bhayya question koncham clear cheppu... rendu tables ila unnayi anuko.....nuvvu cheppina dani prakaram...result set emi undali post cheyyi. Id tbl1_Col1 tb1_Col2 1 12.345 31.097 2 19.876 38.123 3 23.321 41.961 4. 31.111 26.211 5. 52.232 32.323 6. 21.211 45.553 I have another table, name it as table 2 as below: Id Name Address City tbl2_col1 tbl2_col2 1 John 12 Key St Honolulu 15.234 32.135 2 Wilson 31 Poni St Edward 21.345 39.987 3 tom 29 Vinerd james 26.916 45.131 5. sam 43 Main Maui 21.211 45.553 6. ham 53 Main Maui 52.232 32.323 7. pam 63 Main Maui 11.111 22.222 Bhayaa, ee scenario lo ...naku oka formula undhe.... aa formula lo ..each row in second table i need to compare with the above lookup and find out the shortest difference.....
Recommended Posts