query

How can i get rid of 'ORA-01489: result of string concatenation is too long' in this query?

this query gets the dominating sets in a network. so for example given a network A<----->B B<----->C B<----->D C<----->E D<----->C D<----->E F<----->E it returns B,E B,F A,E but it doesn't work for large data because i'm using string methods in my result. i have been trying to remove the string methods and re...

sql query - how to count values in a row separately?

I have a table that looks something like this: id | firstperson | secondperson 1 | jane doe | 2 | bob smith | margie smith 3 | master shifu | madame shifu 4 | max maxwell | I'm trying to count all of the firstpersons + all of the secondpersons, if the secondpersons field isn't blank... Is there a way to do that? ...

Extract response header value in IIS logparser

I'm using IIS LogParser 2.2 & I want to get the value of a particular response header. Is there a function I can use in the query to extract the value of one http response header out of the responseHeader field? I'm currently doing this, which is really ugly: substr(ltrim(extract_suffix(responseHeader, 0, 'headername: ')), 0, index_of...

Insert statement with where clause.

I had a table with unique Date_t1 date type field, but in Table description field is not mentioned as unique, now while inserting new row i need to validate if date exist or not, If already exist i should not allow to make changes on that row, neither a new row needs to be created, Any idea how to resolve this problem in efficient way, ...

Range partition skip check

We have large amount of data partitioned on year value using range partition in oracle. We have used range partition but each partition contains data only for one year. When we write a query targeting a specific year, oracle fetches the information from that partition but still checks if the year is what we have specified. Since this yea...

Query a SharePoint List from InfoPath web form in code

I'm writing an InfoPath web form, using C# code behind. The form is a holiday request, after the user inputs the start and end dates I want the code to query a bank-holiday sharepoint list and count occurrences between the dates. I've added the sharepoint list as a second datasource however I'm now stuck. Any ideas? ...

Recursive Query Help

I have two tables in my database schema that represent an entity having a many-to-many relationship with itself. Role --------------------- +RoleID +Name RoleHasChildRole --------------------- +ParentRoleID +ChildRoleID Essentially, I need to to be able to write a query such that: Given a set of roles, return the unique set o...

Drupal + Location Module: How to query blog entry locations

I am using the Location module within Drupal 6 to tag geographical locations to blog entries. So every blog entry has a long/lat My question is: What is the most efficient way of querying all coordinates for all blog entries of a given user? ...

Help with SQL query (list strings and count in same query)

Hi everybody, I’m working on a small kind of log system to a webpage, and I’m having some difficulties with a query I want to do multiple things. I have tried to do some nested / subqueries but can’t seem to get it right. I’ve two tables: User = {userid: int, username} Registered = {userid: int, favoriteid: int} What I need is a q...

How to select n number of rows in ms access

Here is a table patients in MS access database, There is 20 records, I want to select first 0 10 records and after 11-20 records for pagination. How to solve this problem ...

php in_array - unexpected behavior

Not sure why this is happening, but my script doesn't seem to be able to return true for in_array more than once... $saved = '15,22'; $set = explode(",",$saved); //results in Array ( [0] => 15 [1] => 22 ) Then, I query the database: $result = pg_query("SELECT did,vid,iid,value FROM demographicValues"); if(pg_num_rows($result) ...

in mysql table update 'a' record with 'b' and 'b' with 'a'

IN my table there are two field one is name and other is gender I want to fire query so that every male is update with female and vice a versa. I don't want to use procedure ,trigger or function.I have to do this only with simple query. ...

Query string length limit in vba?

I am trying to combine multiple audit tables, and then filter the results into an excel sheet. The Union All and parameters make the query in excess of 1200 characters. It appears the string is truncated when running this. What recommendations can anyone make. I have no control over the database structure and am only reading foxpro free ...

sharepoint (web part filtering) help

I have a Sharepoint question. For our web site we would like to be able to have a combo box from which the end user selects a “Province/State” where they are from. Depending on which “Province/State” he selects, some web parts will be shown (content) and some parts will not be shown... Is there any way to do this easily with Sharepoint? ...

In Python, after I INSERT Into mysqldb, how do I get the "id"?

The primary key. cursor.execute("INSERT INTO mytable(height) VALUES(%s)",(height)) My table has 2 columns: id << primary, auto increment height << this is the other column. How do I get the "id", after I just inserted this? ...

Hibernate advanced select

We want to get a row from a table using Hibernate a la: select max(id) from mytable where date = <date> Then select * from mytable where id = <max_id> We are currently using Hibernate to map mytable to Java domain objects. I know how to load the domain object based on an id. So I could just do #1 using JDBC and then load the dom...

Query design in SQL - ORDER BY SUM() of field in rows which meet a certain condition

OK, so I have two tables I'm working with - project and service, simplified thus: project ------- id PK name str service ------- project_id FK for project time_start int (timestamp) time_stop int (timestamp) One-to-Many relationship. Now, I want to return (preferably with one query) a list of an arbitrary number of projects, sorted ...

How to query collections in NHibernate

Hi, I have a class: public class User { public virtual int Id { get; set; } public virtual string Name { get; set; } public virtual IDictionary<string, string> Attributes { get; set; } } and a mapping file: <class name="User" table="Users"> <id name="Id"> <generator class="hilo"/> </id> <property name=...

sql and linq query

Database has tables Photos and PhotoAlbums. I need a query that will select all albums and only one photo from each album. I need SQL and LINQ version of this query. Thanks in advance. ...

Data in two databases, eager spool resulting in query

I have two databases in SQL2k5: one that holds a large amount of static data (SQL Database 1) (never updated but frequently inserted into) and one that holds relational data (SQL Database 2) related to the static data. They're separated mainly because of corporate guidelines and business requirements: assume for the following problem th...