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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:56:40+00:00 2026-06-15T19:56:40+00:00

I have 2 tables 1st table contain names,email,vegetable_Fruits, and drinks CREATE TABLE Likes (

  • 0

I have 2 tables 1st table contain names,email,vegetable_Fruits, and drinks

CREATE TABLE Likes
(
Name varchar(20),
email varchar(20),
Vegetables_Fruits varchar(20),
Drinks varchar(20)
) 

i am storing name and email of people those like vegetable ,Fruits and drinks
A person can have any one value
if a person likes vegetable i will update the table as

name email 1 0

if a person likes fruits then

name email 2 0

if a person likes drinks then

name email 0 1

Insert query

INSERT INTO Likes(Name,email,Vegetables_Fruits,Drinks)
     VALUES("aaa","aaa@example.com",1,0),("bbb","bbb@example.com",2,0),("ccc","cc@example.com",0,1),("ddd","dd@example.com",2,0),("eee","ee@example.com",2,0),("fff","ff@example.com",1,0),("ggg","gg@example.com",0,1),("hhh","hh@example.com",0,1) 

I have another table which contain list of emails

CREATE TABLE emailList
(
Likes_Vegetables varchar(50),
Likes_Fruits varchar(50),
Drinks varchar(50)
)

Insert Query

INSERT INTO emailList(Likes_Vegetables,Likes_Fruits,Drinks)
       VALUES("aaa@example.com,ff@example.com","bbb@example.com,dd@example.com,'ee@example.com'","hh@example.com,gg@example.com,cc@example.com")

I want to update the 2nd table (emailList) based on the values of 1st table(Likes)
What is the query for this

  • 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-15T19:56:41+00:00Added an answer on June 15, 2026 at 7:56 pm
    update emailList 
    set 
    Likes_vegetables=(select Group_concat(email) from LIKES where Vegetables_Fruits=1),
    Likes_Fruits=(select Group_concat(email) from LIKES where Vegetables_Fruits=2),
    Drinks=(select Group_concat(email) from LIKES where Drinks=1)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have 2 tables 1st table called services has id_service, name, date. description 2nd
I have a table ( sessions ) in a database whose 1st column contain
I have 2 tables employees(id and name) and salary(id, salary), the 1st has 4
I have two database tables, 1st is the TABLE_GLOBAL_PRODUCTS where all products information are
I have 2 tables: 1st holds employees (of ones in any position) and the
I have a table with two columns: person_id person_id with whom 1st field id
I have tables linked by FK, I query on the first table using entity
I have tables Product ( ID, CategoryID, ... ) Category ( ID, Name, ..
I have 2 dictionaries that contain employee information form 2 DB tables in SAP
All I have two table 1st table is : wp_frm_item_metas 2nd table is :

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.