query

SQL Query to remove hyperlinks from a column

Hello, I have a column dek with the following data I like Stack Overflow site. The users and answers are good. I also like site1.com and site2.com. I want to retrun the data as follows I like Stack Overflow site. The users and answers are good. I also like site1.com and site2.com. Basically, want to remove all the hyperlinks...

querying object in rails (no activeRecord, using mongo with mongomapper)

I've got a group of messages in mongo which I am retrieving in rails with @messages = current_user.user_messages(@user) I now want to select the number of messages which were created in the last week, so I thought I could take the @messages and query that directly with @countRecent = @messages.count(:conditions => {:created_at =>{'$...

Mysql performance with nested indices

I have a mysql table (articles) with a nested index (blog_id, published), and performs poorly. I see a lot of these in my slow query logs: - Query_time: 23.184007 Lock_time: 0.000063 Rows_sent: 380 Rows_examined: 6341 SELECT id from articles WHERE category_id = 11 AND blog_id IN (13,14,15,16,17,18,19,20,21,22,23,24,26,27,6330,6331,...

Mysql Query Confusion

Hi, I have these tables: domain domain_module domain_module_feature domain_module_feature_to_domain A domain can have many domain_module_feature(s), the domain_module_feature_to_domain table contains 3 columns - dmf_id, dmf_domain_id and dmf_feature_id. For ease of this example lets assume domain has just 2 columns - dm_id and dm_na...

doctrine query for chained one-to-many relationships

I have three tables A, B, C. A and B have a one-to-many relationship. B and C have another one -to-many relationship. In another word, each A can have multiple Bs, while each B can have multiple Cs. Now I want to do a query for a given record of A, to get all the related Bs which have related Cs. In another word, for a given a, which is...

Submitting 'live' content IE7 Jquery

I have some content that is appended to a form when dropped using the 'droppable/draggable' jquery plugins. Once the content has been appended to the form. I have a button to submit the form. The form submits correctly in all browsers but in IE7. In IE7 it will not submit I'm guessing it does not see the appended 'live' content. Is th...

Help with MySQL statement

I have written the following SQL statement in MySQL : USE my_database; SELECT * FROM some_table WHERE some_column IN (1, 2, 3); This returns a set of rows that have a column value which is a key into a row of another table (call it some_other_table). a b c d <--this is the column with the key 1 2 3 I want to say, ...

QUERY ON DATES TO EXCEL USING C#

I was trying to make excel graphs using query in c# and I need to collect data for the last month. I am using the following code and its not giving any error but its not giving any result either. Basicaly I have the data in excel sheets and using that data im making graphs. First im geting the two dates and converting them to short str...

how to combine 2 tables to 1 table in sqlCE ?

hi i have 2 tables that has the same fields i need to combine 2 tables to 1 table how to do it in sqlCE ? thank's in advance ...

Hibernate query result

I have the following query in my application:v public List getLocation(String id) { List object = null; try { org.hibernate.Transaction tx = session.beginTransaction(); Query q = session.createQuery("from Entrancestolocations as EL left join EL.entrances as E left join EL.location as L where L = " + id); ...

iterate over database query results in vba in excel

Hi. I would like to open a connection to SQL database, and then have access to individual cells. I have an example that uses PivotTableWizard (presented below). I would like to know of a way that does not have anything to do Pivot Tables - I would like to iterate cell-by-cell. Or is this PivotTableWizard suitable for that purpose also? ...

create array from mysql query php

Hi. I have a little problem that I don't understand. I have a db that has an owner and type (and more off course). I want to get a list of all the type values that has owner equal to the current user, but I get only two result $sql = "SELECT type FROM cars WHERE owner='".mysql_real_escape_string($_SESSION['username'])."' AND selling='0...

PostgreSQL - Using COALESCE keyword in SSIS

When I am trying to use the COALESCE key word in an OLE DB Source control, it always returns a negative number in the results set. I am using a Native OLE DB\PostgreSQL Native Provider as a connection to the database and other key words are working correctly. I run the query in PGAdminIII and it returns a numeric data type. I re-engin...

MSQuery query changed in Excel

I have a query that runs in an Excel Macro that has been changed and I can't figure out how to change the code in the macro. The original query is: With ActiveSheet.QueryTables.Add(Connection:=Array(Array( _ "ODBC;DSN=MS Access Database;DBQ=" & strpath & ";DriverId=25;FIL=MS Access;MaxBufferSize=2048;PageTimeout" _ ), A...

How do I return one element from string_to_array() in PostgreSQL 8.4?

I want to parse a field with the following type of value: "DAVE EBERT CONSTRUCTION~139 LENNOX STREET~SANTA CRUZ, CA 95060~~Business Phone Number:(831) 818-3170" I would like to do a query like: Update mytable set street = string_to_array(myfield,'~')[2] But string_to_array does not "return" an array so it can't be chained in this wa...

Grab Next Row in SQL

I am trying to grab a field from the next row of this database. I can use the logged on time to determine the logout time but I would like to also grab the next login time so I can determine the logout [logged off] time as well. Any suggestions? Thank you |-LogonDate---|-PersonID-|-LoggedOnTime---| |5/30 12:00pm |100 |3600 ...

MySQL: Get Root Node of Parent-Child Structure

I have a table similar to this: ================= | Id | ParentId | ================= | 1 | 0 | -----+----------- | 2 | 1 | -----+----------- | 3 | 0 | -----+----------- | 4 | 3 | -----+----------- | 5 | 3 | -----+----------- | 6 | 0 | -----+----------- | 7 | 6 | -----+----------- ...

SQL Server query - loop question

I'm trying to create a query that would generate a cross-check table with about 40 custom columns that show Y or N. Right now I have SELECT DISTINCT [Company], [Option1], [Option2], [Option3], CASE WHEN [Table1].[ID1] IN (SELECT ID2 FROM Table2 WHERE Variable = 1 AND Bit = 1) THEN ...

SQL advanced query - problem with single row aggregate sub query in select clause

I'm trying to execute the following query but I receive a runtime error stating that: "The column is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause." Line number two below is the one that fails with the error above. I don't understand why this query doesn't execute as no g...

Deep eager load on rails

In this thread know how to make a eager load in rails, but how to do this nested? I.e: # get category, random product and random photo @category = Category.find(params[:id], :include => random_product, :include => random_photo) I don't know if I explain... Thanks in advance. ...