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 8645037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:26:44+00:00 2026-06-12T12:26:44+00:00

I have a MySQL table has these fields ID, CID, QUESTION, ANSWER, USER ID

  • 0

I have a MySQL table has these fields

 ID, CID, QUESTION, ANSWER, USER

ID is auto increment, every record in table has ID;

CID is point to ID for ANSWER records

For example, we have 4 records, 2 of question 2 of answer, and Mike answers 2 questions

ID  CID  QUESTION  ANSWER         USER
1    0   Test      NULL           John
2    1   NULL      This is Test   Mike    
3    0   Example   NULL           Tracy
4    3   NULL      Yes it is      Mike

I want to list questions of which is Mike’s answers. How can I match ID and CID fields in same table and print QUESTION for output

  • 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-06-12T12:26:47+00:00Added an answer on June 12, 2026 at 12:26 pm

    I want to list questions of which is Mike’s answers.

    SELECT t1.*
    FROM TableName t1
    LEFT JOIN TableName t2 ON t1.ID = t2.CID
    WHERE t2.Answer IS NOT NULL
      AND t2.User = 'Mike';
    

    SQL fiddle Demo

    Note that this gives you the list of questions that Mike has answered therefore you won’t find mike listed on them:

    ID CID     QUESTION         ANSWER  USER
    1   0        Test             NULL   John
    3   0       Example           NULL   Tracy
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a mysql table that has two fields that store the same type
I have mysql table that has a column that stores xml as a string.
I have MySQL InnoDB table utf-8 encoded. This table has only id and name
I have a MySQL table which has a product_id field (big integer) 1102330008 1102330025
I have a mySQL table that has a column like this: ID ----- 0352
I have a MySQL table that has a field of comma separated values. How
I have a mysql table that has 2 columns - Column 1 contains a
I have a huge MySQL table which has its rows encoded in UTF-8 twice.
Let's say I have 3 MySQL table. A song db called songs that has
I have a table which is being dynamically populated from MySQL. The table has

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.