kotha thread Posted November 14, 2012 Report Posted November 14, 2012 A B C are the three table A is the parent table B is linked by the parent table,dhani primary key and indhulo seq number ni kalipi o primary key chesaru C table vachi related to B....And c table lo multiple rows related to B coz A lo primary key ,B lo sequence numberand C lo sequence number ni kalipi primary key chesaru So i am tryin to pull data from 3 tables A and B antte parledhu...kani C lo multiple rows are related to single row in B ...ela chestharu mama........evaraina cheppandamma...
CheGuevara Posted November 14, 2012 Report Posted November 14, 2012 ardamkaledu bhayya.........inka konchem clear ga cheppagalava...tables columns list chesi and evi primary, evi foreign keys ani
HyderabadPoradu Posted November 14, 2012 Report Posted November 14, 2012 Yes, Inkoncham clear ga cheppu...asal neeku output emm kavalo and table related c is related to table b antunnav...emm relation undhi...avi fact and diemension tables aa?
deals2buy Posted November 14, 2012 Report Posted November 14, 2012 [quote name='CheGuevara' timestamp='1352920385' post='1302796009'] ardamkaledu bhayya.........inka konchem clear ga cheppagalava...tables columns list chesi and evi primary, evi foreign keys ani [/quote]
kotha thread Posted November 14, 2012 Author Report Posted November 14, 2012 [quote name='CheGuevara' timestamp='1352920385' post='1302796009'] ardamkaledu bhayya.........inka konchem clear ga cheppagalava...tables columns list chesi and evi primary, evi foreign keys ani [/quote] Antha clear ga cheppanu kada......A is linked to B and B is linked to C.. need to pull data from three tables....problem is C table consists of multiple rows related to single row in B...... So A & B okka query and C oka query rayala...lekah ronddu kalipi okke dhantlo rayocha.....table ippudu copy cheyali.....but try this...mean while chustha
9Pardhu Posted November 14, 2012 Report Posted November 14, 2012 inner join chesi choodu with the common rows in all the three tables
deals2buy Posted November 14, 2012 Report Posted November 14, 2012 [quote name='SREEE' timestamp='1352920607' post='1302796042'] Antha clear ga cheppanu kada... ...A is linked to B and B is linked to C.. need to pull data from three tables....problem is C table consists of multiple rows related to single row in B...... So A & B okka query and C oka query rayala...lekah ronddu kalipi okke dhantlo rayocha.....table ippudu copy cheyali.....but try this...mean while chustha [/quote] Select A.col, B.Col, C.Col FROM A INNER JOIN B ON A.id = B.id INNER JOIN C ON B.id = C.id Add filters too if you have any
kotha thread Posted November 14, 2012 Author Report Posted November 14, 2012 [quote name='HyderabadPoradu' timestamp='1352920521' post='1302796026'] Yes, Inkoncham clear ga cheppu...asal neeku output emm kavalo and table related c is related to table b antunnav...emm relation undhi...avi fact and diemension tables aa? [/quote] A is Employee Table anuko B anedhi EmpAddressDetails table anuko C anedhi PhNumbersTable anuko....(one can have multiple ph numbers) So A lo nunchi empid vasthundhi....and adhi pattukuntte B lo addressDetails vasthay... inthavaraku okey.....Kani B lo unna primary Key(Combination of A`s PrimaryKey+B`s Unique Key) is the foreign key in PhNumbers table. As i told you earlier....c mapped to B as many to one relation...now naku oksari okka emp details..okke query lo ravali...How
deals2buy Posted November 14, 2012 Report Posted November 14, 2012 [quote name='SREEE' timestamp='1352921058' post='1302796109'] A is Employee Table anuko B anedhi EmpAddressDetails table anuko C anedhi PhNumbersTable anuko....(one can have multiple ph numbers) So A lo nunchi empid vasthundhi....and adhi pattukuntte B lo addressDetails vasthay... inthavaraku okey.....Kani B lo unna primary Key(Combination of A`s PrimaryKey+B`s Unique Key) is the foreign key in PhNumbers table. As i told you earlier....c mapped to B as many to one relation...now naku oksari okka emp details..okke query lo ravali...How [/quote] paina nenu cheppindi try chesava?
kotha thread Posted November 14, 2012 Author Report Posted November 14, 2012 [quote name='9pardhu' timestamp='1352920727' post='1302796056'] inner join chesi choodu with the common rows in all the three tables [/quote] [quote name='deals2buy' timestamp='1352920749' post='1302796062'] Select A.col, B.Col, C.Col FROM A INNER JOIN B ON A.id = B.id INNER JOIN C ON B.id = C.id Add filters too if you have any [/quote] O/P ela vasthundhi mama... like ila na ID Name Address Phnumber 1 xxxxx xxxxxxx 64563453 1 xxxxx xxxxxxx 45748545 2 rows vasthaya..if 2numbers untte..oke emp ki....?
deals2buy Posted November 14, 2012 Report Posted November 14, 2012 [quote name='SREEE' timestamp='1352921282' post='1302796138'] O/P ela vasthundhi mama... like ila na ID Name Address Phnumber 1 xxxxx xxxxxxx 64563453 1 xxxxx xxxxxxx 45748545 2 rows vasthaya..if 2numbers untte..oke emp ki....? [/quote] Yes, 2 rows vasthayi since they have phonenumbers and those stuff diff btw Name, Address raavatam leda?
GoliMaar Posted November 14, 2012 Report Posted November 14, 2012 If you have emplid and a unique sequence number in Phone numbers, This should be the query. Otherwise Give your complete structure of the tables. SELECT A.COLUMNS, B.COLUMNS, C.COLUMNS FROM EMPLOYEE_TABLE A LEFT OUTER JOIN ADDRESS_TABLE B ON A.EMPLID = B.EMPLID LEFT OUTER JOIN PHONE_TABLE C ON A.EMPLID = C.EMPLID AND B.UNIQ_SEQ = C.UNIQ_SEQ ;
deals2buy Posted November 14, 2012 Report Posted November 14, 2012 [quote name='GoliMaar' timestamp='1352923023' post='1302796367'] If you have emplid and a unique sequence number in Phone numbers, This should be the query. Otherwise Give your complete structure of the tables. SELECT A.COLUMNS, B.COLUMNS, C.COLUMNS FROM EMPLOYEE_TABLE A LEFT OUTER JOIN ADDRESS_TABLE B ON A.EMPLID = B.EMPLID LEFT OUTER JOIN PHONE_TABLE C ON A.EMPLID = C.EMPLID AND B.UNIQ_SEQ = C.UNIQ_SEQ ; [/quote] OUTER JOIN aithe duplicates vache chances unnayi kada bhayya.
kotha thread Posted November 14, 2012 Author Report Posted November 14, 2012 [quote name='GoliMaar' timestamp='1352923023' post='1302796367'] If you have emplid and a unique sequence number in Phone numbers, This should be the query. Otherwise Give your complete structure of the tables. SELECT A.COLUMNS, B.COLUMNS, C.COLUMNS FROM EMPLOYEE_[color=#ff0000]TABLE A LEFT OUTER JOIN[/color] ADDRESS_TABLE B ON A.EMPLID = B.EMPLID [color=#ff0000] LEFT OUTER JOIN PHONE_TABLE C[/color] ON A.EMPLID = C.EMPLID AND B.UNIQ_SEQ = C.UNIQ_SEQ ; [/quote] deeni O/p ela untundhi mama....
Recommended Posts