joining an array with a table or...?

Поиск
Список
Период
Сортировка
От Ivan Sergio Borgonovo
Тема joining an array with a table or...?
Дата
Msg-id 20091026141526.4d0094ba@dawn.webthatworks.it
обсуждение исходный текст
Ответы Re: joining an array with a table or...?  (Ivan Sergio Borgonovo <mail@webthatworks.it>)
Список pgsql-general
I've a list of emails and a list of users (with emails).

If the list of emails was already inside a table

create table mails (
 mail varchar(64)
);

create table users (
  name varchar(127),
  mail varchar(64)
);

I'd do:
select coalesce(u.mail, m.mail) from mails left join users on
u.mail=m.mail;

Now mails are into a php array and they may be in the range of 5000
but generally less.

The final query will be something like
insert into mailqueue (qid, uid, mail, ...) select ...

and since some fields are pseudo random sequences computed from a
serial, it would be "clean" to do it just in one query.

Any clean technique?

thanks

--
Ivan Sergio Borgonovo
http://www.webthatworks.it


В списке pgsql-general по дате отправления:

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: cursor MOVE vs OFFSET in SELECT
Следующее
От: Raymond O'Donnell
Дата:
Сообщение: Re: [ANNOUNCE] [pgeu-general] PGDay.EU 2009 - approaching fast!