?
Solved

Selecting data from two tables at the same time

Posted on 2016-10-21
4
Medium Priority
?
24 Views
Last Modified: 2016-10-21
Can i select data from two tables with a single sql sentence and use fetch_assoc and while loop to print the mixed data coming from two tables?
0
Comment
Question by:Braveheartli
  • 2
  • 2
4 Comments
 
LVL 9

Expert Comment

by:Evan Cutler
ID: 41854486
can you please put in code you have already worked on?  This may become easier to answer if we know what we are dealing with.  Thanks.
0
 
LVL 1

Author Comment

by:Braveheartli
ID: 41854495
I'm out of office right now, however what i want to learn is : can i select data like this and print it out with fetch function and while loop?

SELECT * FROM member
LEFT JOIN networking
ON member.networkingID=networking.ID
WHERE member.ID=2
0
 
LVL 9

Accepted Solution

by:
Evan Cutler earned 2000 total points
ID: 41854497
yes.  but using the asterik(*) provides an issue of names identical in both tables.
in order to fetch across the resulting dataset, you will be sucked into a fully qualified column name (ie. networking.column1 and member.column1).  you might want to qualify those names first (ie. netcol1 and memcol1) and use individual columns names instead of the asterik(*).
0
 
LVL 1

Author Closing Comment

by:Braveheartli
ID: 41854501
Thank you
0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this blog post, we’ll look at how using thread_statistics can cause high memory usage.
It’s a season to be thankful, and we’re thankful for users like you who engage on site, solve technology problems, and network with others in the industry. What tech are we most thankful for? Keep reading.
The viewer will learn how to dynamically set the form action using jQuery.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month17 days, 4 hours left to enroll

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question