Re: SQL statement to copy a result set to create another table

Поиск
Список
Период
Сортировка
Искать

Re: SQL statement to copy a result set to create another table

От:
"YC Nyon" <ycnyon@pd.jaring.my>
Дата:
I want to create a new table based on an earlier result set from a SQL
query.
For example;
Query 1:
Select * from test where id >20

This will give me a result that 10 records found.
I would like to create a new table and insert these 10 records.
Also, I looking into views. would that be a better choice. The application
let users store their data via PHP.

Thanks
Nyon


Re: SQL statement to copy a result set to create another table

От:
Bruno Wolff III <bruno@wolff.to>
Дата:
On Thu, Nov 14, 2002 at 11:05:50 +0800,
  YC Nyon  wrote:
> I want to create a new table based on an earlier result set from a SQL
> query.

Look at the documentation for the CREATE TABLE AS command.

Re: SQL statement to copy a result set to create another table

От:
"Jules Alberts" <jules.alberts@arbodienst-limburg.nl>
Дата:
On 14 Nov 2002 at 11:05, YC Nyon wrote:
> I want to create a new table based on an earlier result set from a SQL
> query.
> For example;
> Query 1:
> Select * from test where id >20
> 
> This will give me a result that 10 records found.
> I would like to create a new table and insert these 10 records.

SELECT INTO will do this

> Also, I looking into views. would that be a better choice.

Not if you want create a new table.

> The application
> let users store their data via PHP.
> 
> Thanks
> Nyon
> 
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
> 


FAQ