a webmaster learning community
     Home    Register     Search      Help      Login    
FrontPage Alternative
Sponsors

Hosting from $3.99 per month!

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions. dd

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

 

Using JOIN with fields with same name

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> Using JOIN with fields with same name
Page: [1]
 
ACEDISH

 

Posts: 176
Joined: 9/30/2002
From: Manassas, Virginia
Status: offline

 
Using JOIN with fields with same name - 1/18/2005 22:26:57   
Again I look to the educated people from the outfront forum to help with my blunders..


I put the DRW on a diet and have created an inner join to MSSQL data base, it works fine but with one problem. 2 of the tables contain the same field name of "description" so when
displaying the results it displays the result from table 3....


JOIN:

fp_sQry="SELECT * FROM Alarms INNER JOIN AlarmCodes ON Alarms.AlarmCodeID = AlarmCodes.AlarmCodeID INNER JOIN PlusUnits ON Alarms.MACUnderCU = PlusUnits.MAC ORDER BY MACUnderCU ASC,TimeOccured DESC"

results:

<%=FP_FieldVal(fp_rs,"Description")%>

I tried but with errors
<%=Alarms.FP_FieldVal(fp_rs,"Description")%>

Am I close?

Thanks,
Coz

_____________________________

" Anyone who can only think of one way to spell a word obviously lacks imagination"
BeTheBall

 

Posts: 6385
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Using JOIN with fields with same name - 1/18/2005 23:23:38   
The only way I know around the problem is to SELECT the fields by name, not using *. So for example:

fp_sQry="SELECT Alarms.Description AS AlarmDescription, AlarmCodes.Description AS CodeDescription FROM Alarms INNER JOIN AlarmCodes ON Alarms.AlarmCodeID = AlarmCodes.AlarmCodeID INNER JOIN PlusUnits ON Alarms.MACUnderCU = PlusUnits.MAC ORDER BY MACUnderCU ASC,TimeOccured DESC"

Then to display:

<%=FP_FieldVal(fp_rs,"AlarmDescription")%>

and

<%=FP_FieldVal(fp_rs,"CodeDescription")%>

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to ACEDISH)
dzirkelb1

 

Posts: 1320
Joined: 10/5/2004
From: Cedar Rapids, Iowa
Status: offline

 
RE: Using JOIN with fields with same name - 1/19/2005 16:55:32   
replace
fp_sQry="SELECT * FROM Alarms INNER JOIN AlarmCodes ON Alarms.AlarmCodeID = AlarmCodes.AlarmCodeID INNER JOIN PlusUnits ON Alarms.MACUnderCU = PlusUnits.MAC ORDER BY MACUnderCU ASC,TimeOccured DESC" 


with

fp_sQry="SELECT Alarms.* FROM Alarms INNER JOIN AlarmCodes ON Alarms.AlarmCodeID = AlarmCodes.AlarmCodeID INNER JOIN PlusUnits ON Alarms.MACUnderCU = PlusUnits.MAC ORDER BY MACUnderCU ASC,TimeOccured DESC" 


see if that works




(in reply to BeTheBall)
Page:   [1]
OutFront Discoveries

All Forums >> Web Development >> ASP and Database >> Using JOIN with fields with same name
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts