Re: SQL Puzzle

From: "Jeff Post" <postjeff(at)uwm(dot)edu>
To: "Ben-Nes Michael" <miki(at)canaan(dot)co(dot)il>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: SQL Puzzle
Date: 2002-07-01 18:17:51
Message-ID: NGBBJHPOILLEGEKFHBEIEEMECPAA.postjeff@uwm.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Fill an array with "Absent".
Do a select that will pull the correct entries.
Do a loop and overwrite the appropriate array elements with "Worked" based
on the select results.
Then display the array.

Hopefully this helps,
Jeff Post

-----Original Message-----
From: pgsql-general-owner(at)postgresql(dot)org
[mailto:pgsql-general-owner(at)postgresql(dot)org]On Behalf Of Ben-Nes Michael
Sent: Sunday, June 30, 2002 7:33 AM
To: pgsql-general(at)postgresql(dot)org
Subject: [GENERAL] SQL Puzzle

Hi All

I have a table where all worker logon and out every day:

table columns: record_id, worker, log_time, status, description

If a worker was absent there will be no record for the current day.

Now, I want to query this table to get a list of all days in month and in an
aditional field i would like to put worked/abscent ( depends if he was or
was not )

Is it possible in SQL ?

I thought about fuction with 'for' from 1 to 30 then subselect to check if
worker worked on a current day but its a complicated solution.

Does any body have idea for easier method ?

I can do it easily in php but i want to do as maximum as I can on the db
itself.

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)

In response to

  • SQL Puzzle at 2002-06-30 14:32:46 from Ben-Nes Michael

Browse pgsql-general by date

  From Date Subject
Next Message Gunther Schadow 2002-07-01 23:04:07 Re: recursing down a tree
Previous Message Lamar Owen 2002-07-01 16:36:56 Re: (A) native Windows port