PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Fri Sep 22, 2017 1:06 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Wed Aug 02, 2017 1:49 am 
Offline
Forum Newbie

Joined: Thu Jan 26, 2017 11:36 pm
Posts: 13
here is mysql query it is showing the desired result without any error but not updating the other table
my query is
Quote:
SELECT count(*) as total_score,userdata.first_name,last_name,degree,email_address,nic,university,address,contact,company,age,gender FROM ans inner JOIN userdata on
ans.bio_id = 250 and userdata.bio_id =250
AND
ans.isCorrect = 1 UNION (UPDATE ANS WHERE bio_id=250)


i want to update the other table "result" from the total of ans
what is the correct way please guide me
any help will be much appreciated


Top
 Profile  
 
PostPosted: Wed Aug 02, 2017 11:58 pm 
Offline
Site Administrator
User avatar

Joined: Wed Aug 25, 2004 7:54 pm
Posts: 13427
Location: New York, NY, US
You said update, which might be more complicated. If the query below has the same columns are the table result, then you can do:
Quote:
INSERT INTO result SELECT count(*) as total_score,userdata.first_name,last_name,degree,email_address,nic,university,address,contact,company,age,gender FROM ans inner JOIN userdata on
ans.bio_id = 250 and userdata.bio_id =250
AND
ans.isCorrect = 1 UNION (UPDATE ANS WHERE bio_id=250)


_________________
(#10850)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: Bing [Bot] and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group