query

how to find the first word in the sentence having 'w' in it.

how can i find the first word in my sentence having 'w' character.This character can be present anywhere in my word.example of sentence "Hi xyzwy! what are you doing here?" So the result should be "xyzwy". ...

How to query for the oldest object from db4o?

I have objects that has a DateTime property, how can i query for the oldest object? After asking on db4o forum, I get the answer: It's quite easy: create a sorted SODA-Query and take the first / last object from the resulting ObjectSet. Don't iterate the ObjectSet (therefore the objects won't be activated), just take the required objec...

Need to find date's between 2 date's in SQL Server 2008

Hi I need help with query to find all the dates that between 31/12/2009 and 31/02/2010 In SQL Server 2008 i try this: SELECT convert(varchar(50), MyDate, 103) where convert(varchar(50), MyDate, 103) >= '31/12/2009' and convert(varchar(50), MyDate, 103) <='31/02/2010' but it give me wrong result why ? ...

postgresql help with php loop....

I keep getting an "Notice: Undefined index: did" error with this query, and I'm not understanding why... I'm much more used to mysql, so, maybe the syntax is wrong? This is the php query code: function get_demos() { global $session; $demo = array(); $result = pg_query("SELECT DISTINCT(did,vid,iid,value) FROM dv...

Joining two tables (through a link), one which may yield multiple rows, together into one result.

Lets say I've got a table listing car brands or models: Cars: Id | Brand ----------- 1 | BMW 2 | Audi 3 | Volvo And I've also got another table which links features. Link: Id | carid | featureid ----------------------- 1 | 1 | 1 2 | 1 | 2 3 | 2 | 2 4 | 3 | 1 5 | 3 | 2 6 | 3 | 3 And I've got the tab...

SQLAlchemy custom query column

I have a declarative table defined like this: class Transaction(Base): __tablename__ = "transactions" id = Column(Integer, primary_key=True) account_id = Column(Integer) transfer_account_id = Column(Integer) amount = Column(Numeric(12, 2)) ... The query should be: SELECT id, (CASE WHEN transfer_account_id=1 T...

How do I execute this query in MYSQL?

Suppose I have a column with words: orange grape orange orange apple orange grape banana How do I execute a query to get the top 10 words, as well as their count? ...

how to sort table in access and save it (Update) in access ?

hi i have Database in access Id,Fname i need to sort this database (by Id) and save the new sort (update the table) how i can sort & update ? thank's in advance ...

How to reference the same parameter more than once in a Informix query?

I have a query which I am executing through ODBC on an Informix database. The query is being passed a Parameter (StartDate). I need to use the year of the StartDate numerous times get the data from the correct fields. When I use the query as listed below, it thinks there are 9 parameters. Therefore, I know this syntax is incorrect, h...

How to get values from SQL query made by php?

So I made a query like this global $connection; $query = "SELECT * FROM streams "; $streams_set = mysql_query($query, $connection); confirm_query($streams_set); in my DB there are filds ID, UID, SID, TIME (all INT type exept time) So I am triing to print query relult into form <form> <select class=...

Problem with a SQL statement

I'm trying to enter values into a database table using a form and a PHP function. The PHP seems to be fine as the SQL statement it creates looks okay, but the database always throws up an error. This is the SQL statement that my code has generated (with arbitrary values): INSERT INTO Iteminfo ('itemName', 'itemSeller', 'itemCategory', '...

SQL select order by decimal precision desc

I'm interested in finding the most precise decimal values in a database field. I'd like to be able to sort results by descending precision. Is this possible? e.g. 10.1781253 12345.12435 89.763 1.1 2 ...

how to get time (hh:mm:ss) from sql query ?

hi i have Database with date field. i see the time like: 1900-01-01 13:38:00.000 how i can see it like: 13:38 ? (i work on sql server 2008) thank's in advance ...

MySQL Query order by numer of rows?

I have a mysql table for votes. there's an id, a project_id and a vote field (which is 1 if a specific project is voted). now i want to generate a ranking from those entries. is there a way to get the number of votes for each project_id and automatically sort the entries by the number of TRUE votes of a project with a single mysql query?...

Why better isolation level means better performance in SQL Server

When measuring performance on my query I came up with a dependency between isolation level and elapsed time that was surprising to me READUNCOMMITTED - 409024 READCOMMITTED - 368021 REPEATABLEREAD - 358019 SERIALIZABLE - 348019 Left column is table hint, and the right column is elapsed time in microseconds (sys.dm_exec_query_stats.tot...

LINQ-like or SQL-like DSL for end-users to run queries to select (not modify) data?

For a utility I'm working on, the client would like to be able to generate graphic reports on the data that has been collected. I can already generate a couple canned graphs (using ZedGraph, which is a very nice library); however, the utility would be much more flexible if the graphs were more programmable or configurable by the end-use...

Running query from scratch with something like exec function?

Hi, is it possible to make something similar to the following with Postgresql without using a function? pseudo sql code: select * from sometable where somecol = somevalue AND someothercol IN exec( 'select something from exclusionlist' ) My primary intention is to build up a table with predefined queries to call inside a where clause ...

Enter ID instead of name on submit (form)

In my users_subjects table, I have a user ID and a subject ID. When a user (of admin level) creates a subject they select from a drop down menu a project. Here is the select query to draw up appropriate values: $sql = "SELECT users_subjects.users_subjectsid, subjects.subjectn FROM subjects JOIN users_subjects on subjects.subjectid = us...

How to do NHibernate queries with reference as criterion?

I'm trying to do a query through NHibernate where the criterion for the result depends on a referenced table. How do I do this? Let's look at a simple example: public class Foo { public int Id { get; set; } public string Name { get; set; } public Bar ReferencedBar { get; set; } } public class Bar { public int Id ...

SQL Server 05, which is optimal, LIKE %<term>% or CONTAINS() for searching large column

I've got a function written by another developer which I am trying to modify for a slightly different use. It is used by a SP to check if a certain phrase exists in a text document stored in the DB, and returns 1 if the value is found or 0 if its not. This is the query: SELECT @mres=1 from documents where id=@DocumentID and contains(...