LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-03-2005, 02:35 AM   #1
dsheller
Member
 
Registered: Jan 2003
Posts: 56

Rep: Reputation: 15
[Perl] multi table query


I have a query that polls multiple tables, and some of the fields have the same names in these tables ex:

table 1
field1, field2, field3

table2
field1, field34, field3

They match at field1 and field 3. So my problem is in retrieving the data correctly... I suppose I could do multiple queries to keep it all straight but it would be easier for one. Any ideas will be great!
 
Old 11-03-2005, 03:38 AM   #2
vireshwali
Member
 
Registered: Sep 2005
Posts: 67

Rep: Reputation: 15
select <filed names> from <table1>,<table2>....
 
Old 11-03-2005, 03:40 AM   #3
dsheller
Member
 
Registered: Jan 2003
Posts: 56

Original Poster
Rep: Reputation: 15
My problem isn't with the query, rather it is with how do I access the data AFTER I run the query... seeing as some of the field names are the same.
 
Old 11-03-2005, 03:42 AM   #4
vireshwali
Member
 
Registered: Sep 2005
Posts: 67

Rep: Reputation: 15
try this.....
select table1.field1 as f1, table1.field2 as f2, table2.field1 as f3, table2.field2 as f4 from table1,table2........
 
Old 11-03-2005, 05:32 AM   #5
dsheller
Member
 
Registered: Jan 2003
Posts: 56

Original Poster
Rep: Reputation: 15
Thanks for that. I tried it, but in the end I figured that renaming the fields so they don't overlap would be the easiest solution.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Routing table query mickboda Linux - Networking 3 11-05-2005 11:11 AM
Suse 9.3: Partition Table overwritten on multi-boot system ChillyWillie Linux - Hardware 4 08-24-2005 04:47 PM
Perl/regexp help... - query string parsing... lowpro2k3 Programming 4 05-11-2005 05:18 PM
QUERY: concurrent usage of multi-WLAN cards kevingpo Linux - Software 0 12-21-2004 06:49 PM
MySQL :: Table in query adds significant delay lackluster Programming 7 07-10-2004 03:48 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:26 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration