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.
| Author |
Topic |
|
veerapureddy
Starting Member
4 Posts |
Posted - 2008-03-04 : 07:23:06
|
| Hi i have 6 tables1.location id primary key authorization string count int2.account acc_id primary key loc_id foreign key of location table hsr string3.Line id primary key intaralata string interalat string4.trunk id primary key intaralata string interalat string5.RCF id primary key intaralata string interalat string6.TSG id primary key intaralata string interalat stringnow i need to fetch the field authorization from location table by the following conditinsLOCATION.AUTHORIZATION using ACCOUNT.LOC_ID. If any (LINE/TRUNK/TSG/RCF.INTERLATA/INTRALATA= ’F’), and this value is blank, send LOCATION.AUTHORIZATIONcan anyone help me out in this scenario. i need the sql query for fetching that fiels.thanks in advanvce |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2008-03-04 : 07:33:39
|
Not quite sure what you mean.Something like this?Select l.authorization from location l JOIN account a on a.loc_id = l.idwhere exists(select * from Line where INTRALATA= 'F'union allselect * from trunkwhere INTRALATA= 'F'union all...) Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
veerapureddy
Starting Member
4 Posts |
Posted - 2008-03-05 : 00:56:38
|
| Hi Harsh thanks for ur reply and sorry for not explaining my problem clearly.again im explaining the problem, please provide me the query.i am having the follong tables1)location table contains one PK(loc_id)and authorization field, etc.2)accont table contain one FK(loc_id) and hrid , attuid fields etc3)LINE table contains INTERLATA_PIC_FREEZE & INTRALATA_PIC_FREEZE and some more fields.4)TRUNK table contains INTERLATA_PIC_FREEZE & INTRALATA_PIC_FREEZE and some more fields.5)NODAL_TSG table contains INTERLATA_PIC_FREEZE & INTRALATA_PIC_FREEZE and some more fields.6)REMOTE_CALL_FWD table contains INTERLATA_PIC_FREEZE & INTRALATA_PIC_FREEZE and some more fields.7)Order2misc table contains FK(SER_LOC_ID) of Location tablePIC means INTERLATA_PIC_FREEZE/INTRALATA_PIC_FREEZE PLOC means INTERLATA_PIC_FREEZE/INTRALATA_PIC_FREEZEi need to send an authorization field value to another interface.condition===========if(LOCATION.AUTHORIZATION using Account.loc_id is not null and LINE.INTERLATA_PIC_FREEZE not equal to 'F' and LINE.INTRALATA_PIC_FREEZE not equal to 'F' and similaraly for TRUNK, NODAL_TSG and REMOTE_CALL_FWD table fields)else(fetch the authorization field from LOCATION.AUTHORIZATION using Order2misc.ser_loc_id) |
 |
|
|
veerapureddy
Starting Member
4 Posts |
Posted - 2008-03-05 : 00:57:06
|
| Hi Harsh thanks for ur reply and sorry for not explaining my problem clearly.again im explaining the problem, please provide me the query.i am having the follong tables1)location table contains one PK(loc_id)and authorization field, etc.2)accont table contain one FK(loc_id) and hrid , attuid fields etc3)LINE table contains INTERLATA_PIC_FREEZE & INTRALATA_PIC_FREEZE and some more fields.4)TRUNK table contains INTERLATA_PIC_FREEZE & INTRALATA_PIC_FREEZE and some more fields.5)NODAL_TSG table contains INTERLATA_PIC_FREEZE & INTRALATA_PIC_FREEZE and some more fields.6)REMOTE_CALL_FWD table contains INTERLATA_PIC_FREEZE & INTRALATA_PIC_FREEZE and some more fields.7)Order2misc table contains FK(SER_LOC_ID) of Location tablePIC means INTERLATA_PIC_FREEZE/INTRALATA_PIC_FREEZE PLOC means INTERLATA_PIC_FREEZE/INTRALATA_PIC_FREEZEi need to send an authorization field value to another interface.condition===========if(LOCATION.AUTHORIZATION using Account.loc_id is not null and LINE.INTERLATA_PIC_FREEZE not equal to 'F' and LINE.INTRALATA_PIC_FREEZE not equal to 'F' and similaraly for TRUNK, NODAL_TSG and REMOTE_CALL_FWD table fields)else(fetch the authorization field from LOCATION.AUTHORIZATION using Order2misc.ser_loc_id) |
 |
|
|
|
|
|