468,550 Members | 1,692 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,550 developers. It's quick & easy.

getting 4 consective values in a query... this is interesting and hard

I have a table
"search_log"
that logs all search by client
here are some of the fields query_date , query_result, query_code

here is the thing as the owner of the site I want to be able to see a user that searched four times in a row that has no result to be able to save them and stop the from being disappointed

if a client searches and there is no result it automatically inserts a data like this
query_date = NOW(),
query_result = 0,
query_code = LIKE '%querystring%'


now i want to be able to find a client that has four "CONSECUTIVE" searches in a row that has four zero "0" query_result


i am looking for something like this


query_date = 10/11/2001
query_result = 0

query_date = 10/11/2001
query_result = 0

query_date = 10/11/2001
query_result = 0

query_date = 10/11/2001
query_result = 0

they have to be consecutive

by the way my table is having 3 million records so Can you please advice me a query that can run faster
Nov 2 '11 #1
1 1219
johny10151981
1,059 1GB
The Query should be like this

Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM choosentable where query_result = 0 ORDER BY DATE Limit 0,4
  2.  
Nov 9 '11 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

8 posts views Thread by Adam Louis | last post: by
reply views Thread by Anil Kumar Lakky Reddy | last post: by
1 post views Thread by UniDue | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.