mtkr Posted June 3, 2015 Report Posted June 3, 2015 select * from TABLE A left join TABLE B on A.ID = B.ID union select * from TABLE C left join TABLE D on C.CUST = D.CUST union select * from TABLE C left join TABLE B on C.ID = B.ID
ranjith23 Posted June 3, 2015 Author Report Posted June 3, 2015 dude ee conditions tho relation ela form chesthavv... Isssue is we are currently using SQL server 2008. 2014 ki upgrade chestunnam. 2014 no longer supports *= and =*. so we need to replace them with LEFT and RIGHT joins. So we need to modify below SQL to make it work and both should fetch output results.. select * from TABLE1 A , TABLE2 B , TABLE3 C , TABLE4 D where A.ID *= B.ID and C.CUST *= D.CUST and C.ID *= B.ID
ranjith23 Posted June 3, 2015 Author Report Posted June 3, 2015 1. TABLE A left join TABLE B on A.ID = B.ID ---- B ekkada use lekapothe......... y u r joining.. 2. TABLE C left join TABLE D on C.CUST = D.CUST 3. TABLE C left join TABLE B on C.ID = B.ID -- bcoz u r using Here...... Then again top enduku ani Y are you joining ki answer teledhu bhaya...bcoz its not a new requirement. its a requirement to replace *= and =* with LEFT,RIGHT joins. Need to modify below SQL with LEFT.RIGHT joins adhi matter.. SQL: select * from TABLE1 A , TABLE2 B , TABLE3 C , TABLE4 D where A.ID *= B.ID and C.CUST *= D.CUST and C.ID *= B.ID
mtkr Posted June 3, 2015 Report Posted June 3, 2015 Isssue is we are currently using SQL server 2008. 2014 ki upgrade chestunnam. 2014 no longer supports *= and =*. so we need to replace them with LEFT and RIGHT joins. So we need to modify below SQL to make it work and both should fetch output results.. select * from TABLE1 A , TABLE2 B , TABLE3 C , TABLE4 D where A.ID *= B.ID and C.CUST *= D.CUST and C.ID *= B.ID inthaki em sql idi?? ee *= n =* no idea...
mtkr Posted June 3, 2015 Report Posted June 3, 2015 Isssue is we are currently using SQL server 2008. 2014 ki upgrade chestunnam. 2014 no longer supports *= and =*. so we need to replace them with LEFT and RIGHT joins. So we need to modify below SQL to make it work and both should fetch output results.. select * from TABLE1 A , TABLE2 B , TABLE3 C , TABLE4 D where A.ID *= B.ID and C.CUST *= D.CUST and C.ID *= B.ID ??? select * from TABLE A left join TABLE B on A.ID = B.ID left join TABLE C on C.ID = B.ID left join TABLE D on C.CUST = D.CUST
ranjith23 Posted June 3, 2015 Author Report Posted June 3, 2015 inthaki em sql idi?? ee *= n =* no idea... 2008 SQL server lo they work. 2014 SQL server to same SQL execute chesthey we get below error: Msg 4147, Level 15, State 1, Line 51 The query uses non-ANSI outer join operators ("*=" or "=*"). To run this query without modification, please set the compatibility level for current database to 80, using the SET COMPATIBILITY_LEVEL option of ALTER DATABASE. It is strongly recommended to rewrite the query using ANSI outer join operators (LEFT OUTER JOIN, RIGHT OUTER JOIN). In the future versions of SQL Server, non-ANSI join operators will not be supported even in backward-compatibility modes.
ranjith23 Posted June 3, 2015 Author Report Posted June 3, 2015 ??? select * from TABLE A left join TABLE B on A.ID = B.ID left join TABLE C on C.ID = B.ID left join TABLE D on C.CUST = D.CUST Bhaya found solution. select * from TABLE1 A , TABLE2 B , TABLE3 C , TABLE4 D where A.ID *= B.ID and C.CUST *= D.CUST and C.ID *= B.ID AND BELOW SQL both are same. So C left join D tesesa. Its working now. thanks select * from TABLE1 A , TABLE2 B , TABLE3 C , TABLE4 D where A.ID *= B.ID and C.CUST *= D.CUST
loveindia Posted June 3, 2015 Report Posted June 3, 2015 inthaki em sql idi?? ee *= n =* no idea... Dat is ansi sql man...
loveindia Posted June 3, 2015 Report Posted June 3, 2015 3 left joins with a b c d order on the conditions provided is the answer man..
Recommended Posts