mysql - Determine entrys with "missing" subsequent entry in SQL -


i have table in sql represent sort of events. try determine lines specific event not "followed" specific event. in table below lines signed did not sign out afterwards (lucy , joe). achievable sql , if yes how?

|id|name      |event     | ========================== |01|fred      |sign   | ------------------------- |02|joe       |sign   | -------------------------- |03|lucy      |sign   | -------------------------- |04|joe       |do foo    | -------------------------- |05|joe       |sign out  | -------------------------- |06|joe       |sign   | -------------------------- |07|fred      |sign out  | -------------------------- 

many thanks

select *  table t1 left outer join table t2 on(t1.name=t2.name , t2.event='sign out') t1.event='sign up' , t2.name null 

there's no such thing "followed by" unless define you'll need provide more info. (it might adding "t1.id >t2.id" in on clause)


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -