RE: Iterations in a SELECT
От | Robby Slaughter |
---|---|
Тема | RE: Iterations in a SELECT |
Дата | |
Msg-id | EPEHLKLEHAHLONFOKNHNCEPLDCAA.webmaster@robbyslaughter.com обсуждение исходный текст |
Ответ на | Iterations in a SELECT ("Scott Muir" <wsmuir@islandnet.com>) |
Ответы |
RE: Iterations in a SELECT
|
Список | pgsql-novice |
Scott, >I'm trying to put together a select where a list dates is compared to a >period to identify dates which aren't in the list... Sounds like you are trying to find out what values are not in a list of other values. Here's my example which you can adapt (if it's what you're trying to do). Two tables, test and test2, each with an integer column called val and val2 respectively: select * from test; val --- 1 2 3 5 6 3 select * from test2; val2 ---- 3 4 Then you do a quick subselect and... select * from test where val not in ((select val2 from test2)); Result is: val ----- 1 2 5 6 Is that what you're hoping to do? I can't think of anyway to do a select and genrate a list from x to y. Wow, that's a great one! Hope this helps, -Robby I could just create a list of days in a table (like 20 years worth) and then compare it, but I'm wondering if there is a trick where one could get results like this select (for i := 1 to 5) as number; or select i as number from for(i,1,5); and get something like number ------ 1 2 3 4 5 Any suggestions? Thanks Scott. ---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/users-lounge/docs/faq.html
В списке pgsql-novice по дате отправления: