FAQ Database Discussion Community


retrieve second 10 UNIQUE rows in SQL

sql,sql-server,distinct,between,rownum
I want to retrieve the second 10 UNIQUE rows in my sql database, for selecting the second 10 rows, I use the next script: SELECT col1, col2 FROM ( SELECT col1, col2, ROW_NUMBER() OVER (ORDER BY ID) AS RowNum FROM MyTable ) AS MyDerivedTable WHERE MyDerivedTable.RowNum BETWEEN 10 AND 19...

Oracle BETWEEN two dates stored as INT

sql,oracle,date,int,between
I'm new to DB's, I have a table within Oracle with dates stored as INT, my SELECT statement I include TO_DATE() so I can see the date, I then want to add a WHERE BETWEEN and use "dates" but I feel like there has to be a cleaner more efficient...

BETWEEN with range including '1' also returns '10'

php,mysql,zend-framework2,between
I'm getting some unexpected behaviour using a BETWEEN predicate in ZF2. Consider the following code: $ranges = array( array( 'min' => 2, 'max' => 4 ), array( 'min' => 7, 'max' => 9 ) ); $predicates = array(); foreach($ranges as $range){ // create a new 'Between' predicate and add it...

Take out date values between two dates from matrix variable, Matlab [SOLVED]

matlab,date,equality,between
I'm trying to take out two separate years from a date table. % Date table Datez = [2001 2;2001 5;2001 9;2001 11;2002 3;2002 5;2002 7;2002 9;2002 11;... 2003 2;2003 4;2003 6;2003 8;2003 10;2003 12;2004 3;2004 5;2004 7;... 2004 9;2004 11; 2005 10;2005 12] I want to take out all values...

Remove all characters between 2 characters in a String

java,string,char,between,removeall
I have a database with 50000 rows. I want to get all rows one by one, put them into a String variable and delete all characters between "(" and ")", then update the row. I just don't know how to delete all characters between "(" and ")". I want to...

Conditional select between dates

mysql,sql,date,datetime,between
I have a table and would like to find minimum and maximum values of price. I would like to get minimal price from action_table when current date between "from" and "to". from to action_price price 2015-04-02 2015-08-02 20 25 2015-04-02 2015-04-20 0 30 2015-04-03 2015-04-21 0 40 So from the...

Mysql query to select records where the sum of a column's values is in a given variable range

php,mysql,variables,select,between
I've been trying to write a query to select all records from a table where the sum of a column's values is between a variable range. Here's what I came up with so far: $result = mysql_query(' SELECT * FROM table WHERE SUM(column) BETWEEN $Range1 AND $Range2 ORDER BY RAND());...

Make SELECT of an specific hour using 2 different hours in 2 different columns with DATE format

mysql,between
I have the following table Table name users id, name, starthour(DATE), endhour(DATE) 1, "patrick", 17:35:00, 19:00:00 2, "gloria", 21:22:00, 22:00:00 3, "david", 22:29:00, 23:33:00 I would like to SELECT only the rows that happens for example between 21:00 and 21:59. I am stuck trying to make a SELECT of an...

Oracle : Search between two Timestamps is not working

oracle,timestamp,between
I am trying query the records between two timestamp in oracle. Timestamp value in db is "02-JUL-14 02.24.04.000000000 PM" select * from event_detl where START_DT between to_timestamp('02-07-2014 02:24:03', 'dd-mm-yyyy hh24:mi:ss') and to_timestamp('02-07-2014 02:24:05', 'dd-mm-yyyy hh24:mi:ss') Currently above query is not returning any record though record exists.Please help....

SQLite query select between 2 records on same condition

sqlite,time,count,between
i am trying to count (in minutes) between two records on 1 table and WHERE clause is the same condition. _id | venue_id | act_time | status | 1 | 1 | 13:30 | 0 | 2 | 1 | 15:40 | 1 | 3 | 2 | 13:03 |...

Regex Find last word between comma

regex,comma,between
I Have something like this : "my item1,item2,item3,item4," I just want as answer : "item4" I use this : (?<=\,).*(?=\,$) but it returns me : "item2,item3,item4" How I can get only the last ? I know that something with the lazy sign ? , but I'm not able to use...

sql query to check data present in given range and data not present in given range

sql-server,between
I have a table demo in which current column is present.I want a sql query which displays data where current is between range 10 and 90 and current values which are not present in the range near 30 and 40 through a single sql query.

PowerShell: Find Text between two Words

regex,apache,tomcat,powershell,between
I need to find out, if there are maxThreads and/or maxConnections configured in the connector port 8080 of tomcat. example: <Connector port="8080" protocol="HTTP/1.1" maxThreads="600" maxConnections="3000" connectionTimeout="20000" redirectPort="443" /> I tried it with regex but poorly failed. $file = Get-Content "D:\Program Files\Apache Software Foundation\Tomcat 7.0\conf\server.xml" $pattern = "(?<=.*protocol=""HTTP/1.1"")\w+?(?=connectionTimeout=""20000"".*)" $Opts = [Regex]::Match($file,...

String query Search and filter between Dates

sql,date,search,filter,between
String query = "SELECT * FROM salesTable where timeStamp BETWEEN '"+startdate+"' AND '"+enddate+"' ( sellid LIKE '%"+search_str+"%' OR tastemodel LIKE '%"+search_str+"%' OR bezeichnung LIKE '%"+search_str+"%' OR sellid LIKE '%"+lastName+" "+firstName +"%' ) ORDER BY timeStamp DESC"; How can I combine a normal string search with between two dates?...

working days between two date firebird

sql,date,firebird,between
I need to count working days between two date in firebird base(ver 2.5) I have table(table_date) with working days (date, day--Free/Working) and i have another table with start_date and end_date. For example we have two dates start_date=2015-04-04 and end_date=2015-04-10 Day 2015-04-05 and 2015-04-06 are Free. Between this dates is 6...

filter table mysql using multiple colums also between

php,mysql,filtering,between,sql-like
how to join BETWEEN statement and AND statement using multiple category? SELECT * FROM quick_inquiry WHERE inquiry_time BETWEEN '$start' AND '$end' AND inquiry_language LIKE '%$language%' AND service_country LIKE '%$country%' AND category LIKE '%$category%' AND replied LIKE '%$replied%' ...

SQL select query between two dates

sql,date,select,between
How do I list all movies released between 2000 and 2010? SELECT title FROM films WHERE releaseYear > 2000 && < 2010 or do I have to use 'between'? I'm new to this and I'm trying to learn. I've looked for similar questions here on stackoverflow, but everyone seems to...

looking for 1-3 words preceded by 4 digit number followed by non alpha characters or 1-4 specific words

regex,excel,between,words
I am looking through a long list of data in excel. In this long list there is a column that has a mix of number characters (digits) and alpha characters, and non-alpha-numeric characters. – so a text column. I am trying to find 1-2 words in the middle of the...

Oracle date between two dates

sql,oracle,oracle10g,between,date-arithmetic
I'm looking for rows where Date_Created is greater than 15 minutes ago, back to 4 days ago This works: where h.Date_Created < (Sysdate - interval '15' minute) and h.Date_Created > (Sysdate - 4) This also works: where h.Date_Created <= (Sysdate - interval '15' minute) and h.Date_Created >= (Sysdate - 4);...

Mysql count and group between specific dates

php,mysql,group-by,between
I have a problem with a query. I have a table like this: tbl_people id | startDate | endDate | Gender 1 | 2010-03-01 | 2011-04-11 | m 2 | 2010-04-01 | 2010-06-14 | f 3 | 2010-03-01 | 2010-04-11 | m 4 | 2009-09-09 | 2009-10-10 | f For...

replacing part of string using sed

replace,sed,between
I have this big file 1,000,000+ lines, which includes some memory data. For a certain use I need to convert g to mb, example: DateAndTime#15/03/15 07:57:07 ********************** top - 07:57:27 up 2 days, 15:28, 18 users, load average: 4.65, 3.15, 2.11 Tasks: 774 total, 2 running, 771 sleeping, 0 stopped,...

Find record between two dates

sql,sql-server-2008,between
When I write below query it gives record . SELECT [srno],[order_no],[order_date],[supplier_name],[item_code],[item_name],[quntity] FROM [first].[dbo].[Purchase_Order] WHERE order_date BETWEEN '22/04/2015' AND '4/05/2015' In this query if I don't add 0 in '4/05/2015' it returns record. But when I add 0 to the date i.e. '04/05/2015' it doesn't give any records. SELECT [srno],[order_no],[order_date],[supplier_name],[item_code],[item_name],[quntity] FROM...

Cassandra SELECT BETWEEN two dates

sql,cql,between,cql3
How can i convert below SQL query to CQL query? SELECT * FROM csv_report WHERE sensor_id=170268 AND create_day BETWEEN 20150401 AND 20150403; also i trying different BETWEEN query: SELECT * FROM csv_report WHERE sensor_id=170268 AND create_day >= 20150401 AND create_day <= 20150403; But this query raised an error: code=2200 [Invalid...

Mysql between operator showing only the first row

php,mysql,sql,between
I have a query like this: SELECT * FROM bcl1_logs where created_at between '2015-02-07' and '2015-02-10' and a table like this: 0 = "id":1, "pc_name":"BCL101", "created_at":"2015-02-07 22:25:44" 2 = "id":2, "pc_name":"BCL101", "created_at":"2015-02-07 22:25:44" 3 = "id":3, "pc_name":"BCL101", "created_at":"2015-02-10 22:25:44" When i query my statement, it's only showing the first two...

Make SELECT of an hour between to hours that are in 2 different columns

mysql,between
I have the following table. I would like to make a SELECT of only the rows where the hour 11:35 is between starthour and endhour. TABLE NAME USER id, name, starthour(DATE), endhour(DATE) 1, "mariano", 10:35:00, 13:00:00 2, "patrick", 17:35:00, 19:00:00 3, "gloria", 21:22:00, 22:00:00 4, "david", 22:29:00, 23:33:00 If tried...

Does it make sense to use Hibernate clear method and then rollback?

hibernate,clear,rollback,between,difference
I want to know if there is any difference between hibernate's session.clear method and rollback() method? I understand that session.clear() will clear objects from the session and rollback() will rollback whole transaction. My question is will there be any performance difference if I use both methods together - first call...

Between doesn't yield expected results in pgsql in function

postgresql,postgresql-9.2,psql,between
I have the following sequence in pgsql in PostgresSQL 9.2.10. The SELECT statement works as expected. foreman=> SELECT 'architectures', id, created_at FROM architectures WHERE created_at BETWEEN '2015-05-04 12:03:38.234225' AND now() ; ?column? | id | created_at ----------+----+------------ (0 rows) The following is the function definition: foreman=> CREATE OR REPLACE FUNCTION...