query

Issue with adding new properties to existing Google AppEngine data models / entities

In GAE, I have a model called Foo, with existing entities, and attempt to add a new property called memcached to Foo that takes datetime values for the last time this value was set to memcache. If I try to query and sort on this property, or even filter for entities that do not have a value for memcached, entities that haven't had a val...

MySQL query to delete rows whose dates are close to another row

I've got a table containing many rows. The rows are guaranteed to have been inserted in order of a column called created_on, which is a datetime column. If a given row has a created_on time within 5 seconds of an existing row, I'd like to delete the given row. How would I write a query to delete those rows? ...

Basic help with sqllite in C# needed - returning strings or ints from a query

I'm using Microsoft Visual C# 2008 Express Edition with SqlLite. I'm successfully able to open my database and with C# code, add entries to my tables. When it comes to retriving data, I'm having some issues and have been searching and searching the internet for basic tutorial information on how to do these basic things... Here's my co...

How do I get around the "'" problem in sqlite and c#?

I'm working in Microsoft Visual C# 2008 Express with Sqlite. I understand that an apostrope (') in my text has problems in a query. My problem is that I thought I could replace it with \'. It doesn't seem to be working... Here's a parred down example of my code: string myString = "I can't believe it!"; cmd.CommandText = "Insert into ...

How to do "select current_timestamp" in hsqldb?

Oracle: select systimestamp from dual MySQL: select current_timestamp SQL Server: select current_timestamp PostgreSQL: select current_timestamp The question is, how can I get the current timestamp in HSQLDB? I use version 1.8.0.10 ...

Update using linq

how can i update a record against specific id in (Linq to sql) ...

DB2 Equivalent to SQL's GO?

I have written a DB2 query to do the following: Create a temp table Select from a monster query / insert into the temp table Select from the temp table / delete from old table Select from the temp table / insert into a different table In MSSQL, I am allowed to run the commands one after another as one long query. Failing that, I can ...

Help optimize an Oracle query?

Hi folks, I'm trying to get better performance out of this Oracle query (which is terribly slow). I'm an Oracle beginner so maybe someone can point out a better way to approach this query. I have a table with information on different families. I want to extract the different relationships based on a relationship type. The solution I cam...

mysql union question

mysql> select job_desc_title from postings where id=194582; +-----------------------------+ | job_desc_title | +-----------------------------+ | Speech/Language Pathologist | +-----------------------------+ 1 row in set (0.00 sec) mysql> select email_address,first_name,last_name,home_phone_area,home_phone_num from accou...

How to do a union across multiple Sql Server?

I have two Sql Servers (two distinct databases, (i.e. two machines)) with the same structure. Is there a way to do a SELECT * FROM (SELECT * FROM TableOnServerA Union SELECT * FROM TableOnServerB)? Thanks ...

Database Design for Transport timetable system

Its been a while since my Database Design classes in my sophomore year at Uni. and I haven't done any designs in the interim so my skills are at best rusty at the moment. I have begun working on a personal project involving the railway timetable system and seem to be stuck at the table design which resembles something like this - Stati...

MySql Group by

Hi all so I have the following table, 't1' id r_id o_id count 1 2 100 1 2 3 100 1 3 5 100 1 4 2 101 2 5 3 101 2 6 4 101 2 What I'm trying to do is, for a given list of r_id's, return the r_id and o_id where the count...

Query Trac for all tickets related to a user

How do I query for all trac tickets related to a user. i.e. all tickets for which the tickets were once assigned, assigned now, created , etc etc ...

how to query without defining table initial name?

Hi, I have following tables. genre: genre_id name actors: actor_id name movies: movie_id actor_id genre_id title I have following query to select all the actors with genre_id 3. select a.name, m.genre_id from actors as a , movies as m where m.genre_id = 3; is it possible to make a query without "movies as m" sin...

SELECT 1 from DUAL: MySQL

In looking over my Query log, I see an odd pattern that I don't have an explanation for. After practically every query, I have "select 1 from DUAL". I have no idea where this is coming from, and I'm certainly not making the query explicitly. The log basically looks like this: 10 Query SELECT some normal query 10 Query...

Two tables of emails addresses, return where one is not in the other

I have a list of e-mails from one database which I want to check against a list of unsubscribed e-mails from another database. If they exist in both lists, then I don't want them returned. SELECT distinct `payer_email` as `email` FROM `database1`.`paypal_table` WHERE `payer_email` != (SELECT `email` FROM `database2`.`Unsubscribers` ...

Why my search wont refine!?!?!

I have this bit of code: //Restrict the SQL query with an AND clause if a member has been selected if ($form_member_id != 0) { $query .= "AND photos.member_id = '$form_member_id' "; } It is meant to refine a search query down to only the selected user, so the whole query together reads: SELECT photos.photo_id, members.member_name, p...

Simple MySQL Table Running Slow Queries

I have a very simple table with two columns, but has 4.5M rows. CREATE TABLE `content_link` ( `category_id` mediumint(8) unsigned NOT NULL, `content_id` int(10) unsigned NOT NULL, PRIMARY KEY (`content_id`,`category_id`), KEY `content_id` (`content_id`,`category_id`) ) ENGINE=MyISAM; When I run a simple query like: SELECT ...

Are the query string variables visible using a Response.Redirect between two Https pages?

I'm looking at a web application with a Response.Redirect between two Https pages. I would assume normally that the query string parameters aren't visible for https requests because of the secure connection. However, since the Response.Redirect sends back the 302 - Object Moved response in between the two pages along with query string va...

DB2 Temp Tables: Not storing or not retrieving information

I'm an MSSQL guy, but I'm working on a DB2 query that needs to create a temp table, insert into it, and do stuff with it. As a much-shortened test, I'm using the following query, which is providing the same result.. declare global temporary table tt_testingSyntax (id int); insert into session.tt_testingSyntax (id) values (1); insert i...