tmartin314
tmartin314

Reputation: 4171

SQL JOIN two tables to access all of the data

I am needing to connect two tables by id then access any of the data from either of them inside a foreach loop.

I've never done any LEFT JOINS or anything so I'm not sure how to start.

The first table named "sys_acl_levels_members" looks like this:

IDMember
IDLevel
DateStarts
DateExpires
TransactionID 

The other table "Profiles" has many more colums but here are the first few:

ID
NickName
Email

I need help with writing an SQL to gather all this information, then some ways to access it inside of a foreach loop.

For example if I wanted to get "DateStarts"," DateExpires" From "sys_acl_levels_members" and "NickName" FROM "Profiles" WHERE IDLevel = ID.

Upvotes: 1

Views: 443

Answers (1)

Thomas O
Thomas O

Reputation: 6220

SELECT acl.DateStarts, acl.DateExpires
FROM sys_acl_levels_members acl
LEFT JOIN Profiles p
ON p.ID = acl.IDLevel

Upvotes: 3

Related Questions