I have this table in PostgreSQL:
CREATE TABLE visit NULL not BIGSERIAL (ID not NULL pRIMARY KEY, slot TSRANGE not NULL, user_id integer reference users (ID), the barrier to exclude use overlapping_timeslots GIST (; & amp; =, with & amp user_id) with slot);
with this data:
| ID | Time Lit | User_id | | 1 | 10.02.2014 10:00 - 10.02.2014 17:00 | 2 | | 2 | 10.02.2014 18:00 - 10.02.2014 19:00 | 2 | | 3 | 11.02.2014 01:00 - 11.02.2014 02:00 | 2 | | 4 | 10.02.2014 12:00 - 11.02.2014 17:00 | 2 | | 5 | 11.02.2014 12:00 - 11.02.2014 12:30 pm 2 |
I need to know how many users are going to visit my shop every day. A user store visited twice a day, it should be double-counted
For example it should be up to
10.02 user = 3 (ID: .. 1, 2,4) user 11:02 = 3 (ID: 3,4,5)
"as an arbitrary period of time for the lack of definition for every day" to:
day, count (*) aS vis, array_agg (id) AS_IDs from gener_series ( '2014-02 -10' :: date, '2014-02-12' :: date interval '1 day') Round on tsrange AS D (day) Join the night (day :: timestamp, day :: timestamp + interval '1 day') & amp; & Amp; Times Lot Group By 1; . Use LEFT JOIN to include the day with 0 visits.
Get link
Facebook
X
Pinterest
Email
Other Apps
Comments
Post a Comment
Popular Posts
Xml parsing with python -
I am using xml with Python xmltodict . But I'm getting the following error, xml.parsers.expat.ExpatError: mismatched tag: line 2890, column2 this is my code, import xmltodict import urllib2 url = "url here" data = xmltodict.parse (urllib2.urlopen (url) .read () print data I have tried to use the Entry here, with the at print, the print code 'urlib2 import lxml.etree', Url = "Url here" xmldata = urllib2.urlopen (url) .read () root = ET.frost string (xmldata) print 'full' print route This also helps me Error, lxml.etree.XMLSyntaxError: Opening and closing tag mismatch: Client ID line 54 and type, line 55, column 14 I know that there is a problem in XML My question is, what is the way to read all the nodes except that it is xml ?
sockets - capturing TCP packets flow -
Problem statement: Suppose a parent is hosted on server machine IP: 1.1.1.1 and something in that server The time is called three different servers A (1.1.1.2), B (1.1.1.3), C (1.1.1.4). They can be server database servers or other servers. Now you can send an http request to 1.1.1.1/somepage.htm from your browser, as a result some TCP packets will go to server 1.1.1.1, and 1.1.1.1 a TCP can send packets and packets, target C as well, without installing any agent software in any server, get all TCP packet information from the browser machine. One solution is that we can write a code on server machine 1.1.1.1 which will filter all TCP packets in relation to the related IP. But I do not want that solution. Is there any way to solve this issue? Is it possible to present a new protocol for this? But server codes can not be modified. Does any agent software include anything like Verhark? The usual way to see all the datagrams obtained is by using sniffing like a wirhark or you can ...
javascript - How to set the table width to parent div width in
wordpress widget -
I am writing a plugin for WordPress and use a table layout in the widget wrapper to display rankings and game schedules. I am doing A line with all the information given is used in approximately 1000 pix width for a widget with a width of 260px or 360px, I want to leave less important information to display the most important information in a row. Due to interchangeable themes in WordPress, I do not know how many widgets will be in WordPress. and examples of my current theme, based on the available width, I want to display more or fewer columns to fill the row. My idea is to first set the width of the table in the inner width of the wrapping divis, that I can do this with something like $ ('# objects'). Width ($ ('# Object') .Parent (.) Width ()); Second, it is my goal that to display some columns per line, depending on the width of the row My questions: Is my planned way of accomplishing this by sending the width of the table as the parameter of the javasc...
Powered by Blogger