query

How to turn this MySQL SELECT query into a DELETE query?

I want to delete certain items from the database. I have the following query: SELECT * FROM sheets, entries WHERE entries.sheetID = sheets.id AND sheets.clientID = 13 This works, and returns 2 results. Now I want to turn this SELECT query into a DELETE query. However, the following doesn't work: DELETE FROM sheets, entries WHERE ...

trouble creating a sql statement select statement reference same table twice

Ok, here is setup. Note the code below is SIMPLIFIED version. PHP 5.2 ENGINE: MyISAM table quotes q table users u FROM quotes q LEFT JOIN users u ON q.qid = u.uid Soo... the quotes table references a user (from users table) (the owner of quote) but quotes table ALSO has a field called createdby (the user who created the quot...

Fetch recently watched videos?

I am using MySQL. I have the following table structure: tablename: Videos videoId title description 1 Video title 1 Some description text1 2 Video title 2 Some description text2 3 Video title 3 Some description text3 4 Video title 4 Some description text4 5 Vi...

What Linux Full Text Indexing Tool Has A Good C++ API?

Hi, I'm looking to add full text indexing to a Linux desktop application written in C++. I am thinking that the easiest way to do this would be to call an existing library or utility. This article reviews various open source utilities available for the Gnome and KDE desktops; metatracker, recoll and stigi are all written in C++ so they...

problem with linq (C#)

var pom= from k in dataContext.student_gods where k.skgod==System.Convert.ToString(2002/03) select k; foreach(var i in pom){ var predmeti = from m in dataContext.student1s where m.id_stud ==System.Convert.ToString(i.id_stud) ...

HIbernate Free Query

hi. I would like to query using hibernate given a particulay query string I did it like this: session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); List<String> result = session.createQuery("Select item_value from cb_items").list(); session.getTransaction().commit(); session.clear(); return result; ...

How To Reduce Number of Rows Scanned by MySQL

I have a query that pulls 5 records from a table of ~10,000. The order clause isn't covered by an index, but the where clause is. The query scans about 7,700 rows to pull these 5 results, and that seems like a bit much. I understand, though, that the complexity of the ordering criteria complicates matters. How, if at all, can i reduce ...

Create two interactive tables

hello, I'm new to programming jquery, I'm trying to make a table from a query in an Oracle database. The code to create the table is something like this: <form method="get" name="SC" > <table id="tabla1" width="1129" height="32" id="tabla" border="3" align="center" bordercolor="#FFFFFF"> <thead> <tr> <th width="77" height="22" ...

Mysql: Get results from all tables

Hello Guys, I just wanted to ask is there an easier way to get records from all tables of db using a single query where some tables are linked using PKs and FKs. For example, i have a drop down which has 'Cars', 'Bikes', 'Trucks', etc When I select Cars, i get results only from the Cars table. But now i have added 'All' to that drop ...

MS Access 2003 - VBA for SELECT query and only choosing specfic record for form

Okay so on this form, I create a grid, almost looks like a bar chart with little "cells" stacked by month. Each of these "cells" are square sub forms, and I create the little square forms that I use as the sub forms. So what I wanted to know is, what is the code (VB) for running a select query, and only working with specific records wit...

Oracle delete user

I have such table: users: id PK . . . workers: id PK user_id (FK to users) . . . evaluations: id PK worker_id (FK to workers) . . . And now I want to delete user. When I delete user then worker also should be deleted. How can I do this? ...

SQL Delete Rows Based on Another Table

Hi, This is probably very easy, but it's Monday morning. I have two tables: Table1: Field | Type | Null | Key | Default | Extra id | int(32) unsigned | NO | PRI | NULL | auto_increment group | int(32) | NO | | 0 | Table2: Field | Type | Null | Key | Defa...

Getting distinct rows based on a certain field from a database in Django

I need to construct a query in Django, and I'm wondering if this is somehow possible (it may be really obvious but I'm missing it...). I have a normal query Model.objects.filter(x=True)[:5] which can return results like this: FirstName LastName Country Bob Jones UK Bill Thompson UK David Smi...

DNS Query Structure

When I am sending a DNS query to the DNS it returns the header with the format bit set. Indicating there is a problem with the format, but I am failing to see what it is. Its possible I have misinterpreted the RFC, or misread it but right now I cant seem to work it out. The DNS structure I am sending looks like this in hex. Header 00...

Help on an SQL query

I have a table named activity with 2 columns: when as datetime // last time i saw a user guid as varchar // a unique identifier for each user This tables is used to track usage in a certain resource. Guid are created by the clients. I want to be able to query how many new users I have in the last day/week/month. A new user is identi...

Hibernate query a foreign key field with ID

For example, I have two entities: Employee and Address. Of these enitities, Employee has a foreign key AddressID references the ID column on Address. In the Java domain objects, Hibernate nicely wraps the forgein key integer field with a Address object field. But now, how could I query the Employee with a certain AddressID? I have trie...

Help on an (another) SQL query

Following my previous question. I have a table named activity with 2 columns: `when` as datetime // last time i saw a user guid as varchar // a unique identifier for each user I have a query that returns how many new users I have for a given date and timespan: SET @till_date='2009-11-01'; #for today, give CURDATE()+1 SET @duratio...

how to neglect this error in sql query

In my application i have got an error while running sql query from remote access ERROR:Operation must use an updateable query. please give me a solution ...

mysql number of people assigned to a task

I have the following tables... Tasks People tasks_people ... and I want to get a list of tasks, with a count of people assigned to them. Note that a person can be assigned to a task more than once (on different dates). For some reason I dont seem to be able to manage it. Thanks for any help! ...

querie in project

Hai i'm a final year engg student . I've decided to do my final project in smart cards. I want to know whether the smart card's can be used for our personal identification. For example: it contain's of our , personal/contact detail's Driving licence info PAN card detail's Bank info Passport detail etc and all the detail's which are r...