ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I need help with a mysql query I am not getting the results I want.
I have two tables
booths(booths , dealer_id)
dealer(dealer_id , first_name, last_name, phone, email)
booths.dealer_id and dealer.dealer_id are not dependant on each other.
In other words there can be a booths with out a dealer_id.
I a query to get all the booths and where there are dealer that goes with it I want to print out that info too.
e.g.
booths1, dealer1, dealer name
booths2, dealer2, dealer name
booths3, NULL
booths4 NULL
I don't mind doing this with two queries I just don't know how to do this without getting redundant infor.
My current queries are:
SELECT booths.booths, dealer.dealer_id, dealer.first_name, dealer.last_name FROM booths,dealer WHERE dealer.dealer_id=booths.dealer_id
and
SELECT * FROM booths
This give redundant info like this:
booths1, dealer1, dealer name
booths2, dealer2, dealer name
booths1, dealer1
booths2, dealer2
booths3, NULL
booths4 NULL
Thanks vi0lat0r but I was hoping for something in a sql query language solution. I will try a couple other ideas and if I come accross something worth while I will post it.
Any one else have an idea?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.