query

Postgresql vlookup

Let's say I have a table "uservalue" with the following columns: integer user_id integer group_id integer value I can get the maximum value for each group easily: select max(value) from uservalue group by group_id; What I would like is for it to return the user_id in each group that had the highest value. The max function in matla...

How best to search a website and retreieve data in PHP?

Hi Guys, Trying to learning some more PHP. Here is what I'm after. Essentially, I would like to search a website and return data to my own website. Add a few keywords to a form. Use those keywords to query a website such as monster.com for results that match the keywords entered. Grab that data and return it to my own website. How...

nHibernate, how query a parent object with multiple relationships

Hi! I have a (several actually) relationship between two objects, the parent object is a User and the child object is an Incident. There are four relationships defined between User and Incident: Property User_created of Incident refers to a User who created the Incident Property User_modified who modified the Incident User_reported and...

Values from multiple tables on a row

Hello, I have the following 3 tables Table1 ID | NAME ----------- 1 | X 2 | Y 3 | Z Table2 ID | NAME ----------- 1 | A 2 | B 3 | C Table3 ID | P (Boolean field) | Other cols 1 | True ... 2 | True.... 1 | False now I need a query on table3 that has to do the following. to display the name field of table1 and table2....

MS Access - How to turn a Dataset/query table into an OLE Object? msAcess 2000

I have some VB that copies OLEobjects into powerpoint automatically for me. The purpose of this is that my database runs queries, and then forms turn them into charts. As it runs through the various queires/form on open/close events the charts are added to a powerpoint presentation. I also have parallel queries that show the resulting d...

PHP & Postgres: View vs. SELECT, when to use a view?

Related to my previous question: PHP and Databases: Views, Functions and Stored Procedures performance Just to make a more specific question regarding large SELECT queries. When would it be more convenient to use a View instead of writing the SELECT query in the code and calling it: $connector->query($sql)->fetchAll(); What are the ...

how to search for whole words efficiently in a sqlite db

Hi, I have a table that has a title column. I want to search for whole words like foo. so match " hi foo bye" o "foo", but not "foobar" or "hellofoo". Is there a way without changing the table structure to do this? I currently use 3 like queries, but it is too slow, I have " select * from articles where title like '% foo' or title...

How do I Write a SQL Query With a Condition Involving a Second Table?

Table1 ... LogEntryID *PrimaryKey* Value ThresholdID - - - Link to the appropriate threshold being applied to this log entry. ... Table2 ... ThresholdID *PrimaryKey* Threshold ... All fields are integers. The "..." thingies are there to show that these tables hold a lot more imformation than just this. They are set up this way for ...

Why is my query demanding more fields in my Group By?

Problem: I originally had a query that was working great but I'm now having to change it to pull more fields. When I try run the new query it picks a field name and says that I haven't included it as part of the aggregate function. Each time I get this error I can add the field the error specifies to the Group By statement and the error ...

Sort DBGrid by clicking column's title

Well, this seems a little tricky (if not imposible). I'm tryin to make my DBGrid sort its data by clicking on column's title. The thing is that I'm (sadly) working with Delphi3, I'm not using ADO DataSets and the query gets a lot of rows, thus I can't reopen my TQuery changing the "order by" clause on clicks. Someone has implemented so...

SQL Query, within php

I currently have a query $query = "SELECT * FROM routes ORDER BY id DESC LIMIT 8;"; And that works all wonderfully. I have table columns id int(10) name varchar(45) base varchar(16) econ int(6) location varchar(12) x int(2) y int(2) galaxy int(2) planet int(2) comm...

SharePoint lookup column across site-collection boundary

The basic situation is that I have a list of company contacts that exist in one site that I would like to share. The contacts are referenced from a list within that site, and I would also like to be able to reference them from a list in another site collection. Lookup columns can only lookup values from a list within a site, but this is ...

Query for a search form

I'm developing a search form. It has about 10 fields and a search button that retrieve records from a table and put them in a gridview. The user can fill some fields, all the fields or none, and then click Search. Only the fields with info has to be used to perform the search. I use a query in a tableadapter of a dataset to make the sea...

There is already an object named 'tbltable1' in the database

I am trying to insert data from one table to another with same structure, select * into tbltable1 from tbltable1_Link i am getting the following error message : There is already an object named 'tbltable1' in the database. ...

Column name or number of supplied values does not match table definition wthout droping table

In SQL server, I am trying to insert values from one table to another by using the below query : insert into tblTable1 ( [Week], 20001, 20002, 20003, 20004, 20006, 20005, W/c ) select * from tblTable1_link ( [Week], 20001, 20002, 20003, 20004, 20006, 20005, W/c ) I am getting the following error : Serv...

Linq query on DataTable

I have a DataTable that is filled from a stored procedure. I am doing a query on the DataTable using a groupby so that I can implement a ListView within a ListView. (Matt Berseth - Building a Grouping Grid with the ASP.NET 3.5 LinqDataSource and ListView Controls) My Query in my codebehind: var query = from c in dtTaskOrder.AsEnumerabl...

Sorting SPARQL results by date

Is there a way to sort the results by creation date? Example query which must be sortet: SELECT * WHERE {?s ?p ?o} limit 200 ...

Query multiple custom taxonomy terms in Wordpress 2.8?

I created a custom taxonomy named 'technologies' but cannot query multiple terms like I can with categories or tags. These querys DO work: query_posts('tag=goldfish,airplanes'); query_posts('technologies=php'); However, neither of the following work correctly: query_posts('technologies=php,sql'); query_posts('technologies=php&tech...

How do I Get a WPF DataGrid to Save Changes Back to the DataBase?

How do I get a WPF DataGrid to save changes back to the database? I've data-bound my DataGrid control to a DataTable object, and populated that table with a very simple SELECT query that retrieves some basic information. The data shows up just fine in the control. But when I use the control to edit the data, the changes are not pus...

SQL help: COUNT aggregate, list of entries and its comment count

So, what I intended to do is to fetch a list of entries/posts with their category and user details, AND each of its total published comments. (entries, categories, users, and comments are separate tables) This query below fetches the records fine, but it seems to skip those entries with no comments. As far as I can see, the JOINs are go...