Jump to content

SELECT DISTINCT?


B0b

Recommended Posts

Hi everyone,

 

I'm trying to copy a column from a table to another while removing duplicate entries then add 3 other columns and fill one of them with numbers from 1 to X -> that's what I'm unable to do.

 

Here's my goal:

 

Table 1:

 

1  bob1

2  bob2

3  bob2

4  bob3

5  bob4

 

Table 2:

 

1 bob1 jack marc

2 bob2 frank stu

3 bob3 some dude

4 bob4 foo bar

 

Here's what I got:

 

<?php
$new = 'tmp_' . $original;

mysql_query(
	"CREATE TABLE $new AS
	SELECT DISTINCT email
	FROM $original" );

 

I'm confused as to how to add the first column.

 

Thanks!  :)

Link to comment
https://forums.phpfreaks.com/topic/203704-select-distinct/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.