Jump to content

[SOLVED] Selecting from multiple db tables


soycharliente

Recommended Posts

I'm not very hip to knowing how to do this and all the text I read is flying above my head.

 

I have a table called officers with fields id, office, abbr, member.

I have a table called profiles with many, many fields, but of interest, firstname, lastname, badge, and primaryEmail.

The fields member and badge are the same (or could be if the person holds an office).

I want to select firstname, lastname, and email from profiles where the member in officers equals badge in profiles (member and badge are both INTs). Does that make sense? Can someone help me? If possible, including an explanation of what is going on so that I can do it myself in the future.

Link to comment
Share on other sites

are trying to ask about joining tables

 

example:

 

SELECT firstname, lastname FROM table1, table2 WHERE member=badge and  member=INTs and badge=INTs;

thats the normal join if you whant to learn more read from basic tutorial of mysql

Link to comment
Share on other sites

okieeeeeeeeeeee

 

SELECT  === it easy ni need to explain

firstname, lastname  === this are the field you want to view add a existing field if u want

FROM == clause initializing what table to use

table1, table2 == the table that u want to use and join/combine

WHERE == declaration of condition

member=badge ==equality of two table(fiels)

and == if theres is still condition u can add another and if u still have condition see next line

member=INTs and badge=INTs;

 

 

relax dont get mad

ASTIG!!!

 

hope that helps

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.