Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
609 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 Answer

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...