Renato De Giovanni <[EMAIL PROTECTED]> writes:
>FOREIGN KEY (object_id, 'X') REFERENCES object (id, class_id)
Why not just store the class_id in the secondary table (if you're
concerned about space, consider using an int4 to represent class_id).
Then you can do a direct two-column foreign
A way to do this is:
Select GETFILE From
(Select Min(DATETIME),SID From LOGS Group by SID) as MDT,
LOGS L
Where
L.SID = MDT.SID
And L.DATETIME = MDT.DATETIME
But this fails if there are more than one row for a given SID/DATETIME pair
(doe you have a unique
Yeah I have been having a bit of a problem expressing myself in terms of
this query, sorry about that.
What I need is:
SELECT getfile FROM logs (and a restriction that results in finding the rows
with the lowest datetime for each unique sid)
To define this table a bit more:
Logs table has a pr
Jeff,
> The query I have now:
>
> SELECT min(datettime), sid FROM logs GROUP by sid;
>
> This returns the first instance of an sid in the logs table, there
> can be
> many rows in the table for each sid. The problem I have is that I do
> not
> need the SID I just need to group the min(d
The query I have now:
SELECT min(datettime), sid FROM logs GROUP by sid;
This returns the first instance of an sid in the logs table, there can be
many rows in the table for each sid. The problem I have is that I do not
need the SID I just need to group the min(datetime) by it. I need to return
Ryan Littrell wrote:
>
> I am trying to execute the following command:
>
> SELECT R.*, distance(L1.lat, L1.lon, L2.lat, L2.lon) AS Distance
> FROM Restaurants R, Locations L1, Locations L2, FoodTypeRestaurantIDX FTR
> WHERE R.Zipcode=L1.Zipcode AND L2.Zipcode = '93705' AND R.Delivery=true AND
>
I am trying to execute the following command:
SELECT R.*, distance(L1.lat, L1.lon, L2.lat, L2.lon) AS Distance
FROM Restaurants R, Locations L1, Locations L2, FoodTypeRestaurantIDX FTR
WHERE R.Zipcode=L1.Zipcode AND L2.Zipcode = '93705' AND R.Delivery=true AND
R.RestaurantID=FTR.RestaurantID AND
Hi,
I doing a log to my DB. For this, I writing a trigger that inserts in a
log table the user, date, table changed and values changed.
I was trying to do a generic procedure and use it on all tables, like
this:
create function sp_log() returns opaque as '
declare