Issue
I have a MySql database round-about 2.5GB,
The table[A] has following columns, |anoid| |query| |date| |item-rank| |url|
I have just created another table[b] having columns only |query|
and |date|
I want to insert all the distinct records in query column, with it's respective date, from Table[A] to [B], is there any fast query?
Solution
Use INSERT INTO ... SELECT
:
INSERT INTO Tableb(query, date)
SELECT query, MAX(Date) AS MAXDate
FROM Tablea
GROUP BY query
This will give you distinct query
with the most recent date
.
Answered By - user8608154
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.