Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Always trips me up!
Message
From
14/06/2007 15:01:32
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01233129
Message ID:
01233217
Views:
20
>>>I ran the two first selects and I see the problem.
>>>
>>>In the StatusHistory table we should have a PK, say, StatusID.
>>>
>>>The code should be
>>>
>>>SELECT Mb.*, Sh.* ;
>>>  FROM Members mb ;
>>>  INNER JOIN StatusHistory sh ON Mb.MemberId = sh.MemberId ;
>>>  WHERE sh.StatusId IN ;
>>>          (SELECT CTOBIN(RIGHT(MAX(DTOS(ChangeDate)+BINTOC(StatusId )),4)) ;
>>>              FROM StatusHistory GROUP BY MemberId )
>>>
>>>That's what happens when you write code based on a sample :)
>>>
>>>You're a cheater by not creating PK in StatusHistory :)
>>
>>OK, one second. Is there anything better about this approach than Sergey's?
>
>There is a difference in these two approaches if you have several same days. In my case it still returns just one record, in Sergey's it would return all of them.

But as in all status history tables, we know that the status may change during the day (asleep, booting, 1st coffee, eating, siesta, nth coffee, drinking, crawling home), so there's no place for a date field - we need a timestamp or a datetime.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform