Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
614 views
in Technique[技术] by (71.8m points)

Running a mysql query from phpmyadmin only changed 1 record. Tried ssh but same issue

I am trying to run a query to combine fields from one table to another table in the same mysql database.

I tried to execute in phpmyadmin and only changes 1 record (but does it correctly)

After research i found that it should not be done in phpmyadmin. So the only other way i know how was in ssh. Im running putty on my windows 8 pc and i can login to my server then i can log into mysql database. When running the query it still only changes on row.

So then i started looking at php's but not sure that's what i need to do. I would assume i could just run this query to go through entire table but maybe im missing something.

Here is the query im running.

INSERT INTO appfilter2 
SELECT userapps.name, GROUP_CONCAT(CONCAT(userapps.activity, '/',userapps.class)) AS activity 
FROM userapps

How can i simply run this query to fill my appfilter2 table with all concatenated entries from userapps?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Your SELECT query is missing a GROUP BY clause. Probably you mean:

INSERT INTO appfilter2 
SELECT userapps.name, GROUP_CONCAT(CONCAT(userapps.activity, '/',userapps.class)) AS activity 
FROM userapps
GROUP BY userapps.name

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...