Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5958303
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:31:26+00:00 2026-05-22T18:31:26+00:00

I have table users and another table premium_users in which I hold the userid

  • 0

I have table users and another table premium_users in which I hold the userid and the date when he bought premium membership.

How can I use mysql join , so that in a single query I can select all the columns from the table users and also know for each premium user the date he joined on.

USERS:

ID USERNAME
1  JOHN
2  BILL
3  JOE
4  KENNY

PREMIUM USERS:

ID USERID DATE
1  2      20/05/2010
2  4      21/06/2011

And the final table (the one that will be returned my the query) should look like this:

ID USERNAME DATE
1  JOHN
2  BILL     20/05/2010
3  JOE
4  KENNY    21/06/2011

Is it ok for some rows to have the DATE value empty?
How can I check if that value is empty? $row['date']=='' ?

EDIT:
This was only an example, but the users table has much more columns, how can I select all from users and only date from premium_users without writing all the columns?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T18:31:27+00:00Added an answer on May 22, 2026 at 6:31 pm
    select u.*, pu.DATE
    from USERS u LEFT OUTER JOIN PREMIUM_USERS pu on
      u.ID = pu.USERID
    

    You can check if a row is empty with:

    if (!$row['DATE'])
    {
       ... 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table users which has a primary key userid and a datetime
Another question which has me perplexed: I have a table which enables users to
I have a table [Users] with the following columns: INT SmallDateTime Bit Bit [UserId],
I have a table of users which has a username column consisting of a
I have a table of Users, Each USR_ID can have multiple Roles,Views,Brands and Units.
I'm using postgres, and I have a users table which contains users first and
I have one table [Users] and another table [Administrators] linked 1:0..1 . Is it
What I have is a two tables. One table with users and another table
I have table ( users ) and I have another table let's say (books)
I have a base table called users which holds all common information about a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.