query

MySQL Multiple Tables Link

Hi there I'm new to these types of MySQL Queries. Basically, I have two tables in a MySQL Database. One is called groupmembers and the other is called users groupmembers contains rows with two columns, a groupid and a userid users contains rows with also two columns, a userid and a username I am trying to write a query that searches t...

Replacing spaces with %20 in C

I am writing a fastcgi application for my site in C. Don't ask why, leave all that part. Just help me with this problem- I want to replace spaces in the query string with %20. Here's the code I'm using, but I don't see 20 in the output, only %. Where's the problem? Code: unsigned int i = 0; /* * Replace spaces with its hex %20 * It...

How many fields are too many when querying MySQL ?

Hi, I have read many times that we have to avoid reading too many fields when querying MySQL (or any database)...just query the fields you need. However I have a project where a table has 100 fields per record/row. The thing is that, everytime I query the database, I need ALL of the fields for further calculations, etc after the query...

How do you group, bucket, and filter a result sets for a very large dataset

Sorry, the question title is somewhat vague, so here's a working example. I have a table into which each user (userid) gets a value every few days. I want to find the last of those values for each user, broken out by month, and count their number into a range. Here's an example table and representative data: CREATE TABLE `datasource` ...

Aggregate or join strings in linq to sql query (SQL Server)

Given a table like ID | Name | City 1 | X | Y 2 | Z | Y 3 | W | K I want to produce a result like ID | Description 1 | Y (X, Z) 3 | K (W) I tried something like From C In Clients Group C By C.ID, C.City _ Into G = Group Select New With {.ID = ID, .Description = City & _ " (" & (From C In Clients Select C.Name).Aggreg...

Problem with sql query

Hello, I'm using MySQL and I'm trying to construct a query to do the following: I have: Table1 [ID,...] Table2 [ID, tID, start_date, end_date,...] What I want from my query is: Select all entires from Table2 Where Table1.ID=Table2.tID **where at least one** end_date<today. The way I have it working right now is that if Table 2...

Hi , I want to make the page when the visitor refresh update the field .. the code is here

Hi , I have a problem with mysql query .. I have a table in the data .. name is (Info_website) , the field is (NumVisitor) .. the problem when the visitor refresh the page I want the filed (NumVisitor + 1) but infact it +2 .. this is the code .. $sql2 = "UPDATE `Info_website` SET `NumVisitor` = `NumVisitor`+1 WHERE `Id`=1 LIMIT 1"; ...

search for value in mysql tables with less queries to the database?

Hi. I have a user with his unique username in a mysql table, but I have to test and do many queries to find it. I wonder if its a better way to avoid all does queries to the db. I have multiple rows in the table with columns like user1, user2, user3, user4 up to 30. for ($x=0; $x < 30; $x ++){ $user = "user"; $user .= $x; /...

SQL to query the maximum number of available items for a specific period (reservation system)

For a reservation system there is an inventory table and each item has a quantity (e.g. there are 20 chairs). Now the user can make a reservation for a specific period (e.g. 5 chairs for two hours "2010-11-23 15:00" - "2010-11-23 17:00"; another reservation could be for several days "2010-11-24 11:00" - "2010-11-26 14:00"). What's the b...

How to build this query in sqlite?

Hello :) I have sqlite3 database with example structure and data: CREATE TABLE person(id INTEGER PRIMARY KEY NOT NULL, name STRING NOT NULL); INSERT INTO "person" VALUES(1,'Jack'); INSERT INTO "person" VALUES(2,'Daniel'); INSERT INTO "person" VALUES(3,'Sam'); INSERT INTO "person" VALUES(4,'T`lc'); CREATE TABLE vote(person_id INTEGER NO...

Group posts by Date on the front page of wordpress

hey guys.. here is what i am trying to say today is Aug 08, 2010..so what will show is Aug 08, 2010 Post title 1 Post title 2 and so on for the other post for this date Aug 08, 2010 Post title 1 Post title 2 and so on for the other post for this date but i also want to show this only 3 time. so it will show all the post grouped ...

MySQL (InnoDB) Select from 2 tables and always get empty result set

Hello, I'm a little confused. I'm using MySQL 5+ with InnoDB as my engine. If I run the following statement and the table 'user_temp' is empty I always get an empty result set no matter what's in the 'users' table. SELECT * FROM `users`, `user_temp` If I put something in 'user_temp' I'll get back all the results. Is this suppos...

MS Access - SQL Query question

System: Windows7, Access 2003, .mdb file, C# language, VS 2010 I'm doing queries with OleDbCommand, so I write the complete sql query in a string. Table Survey (Id) Table Questions (Id,IdSurvey) Table Answers (Id,IdQuestion) the tables are simplified to show only relevant data Assume 1 survey has 1..n questions Assume 1 ...

php script to write files and create zip file

Hi I'm trying to develop an online formbuilder. Each user can build their own forms and I want to be able to provide a button that when clicked will download the users html form page along with its css file as a zip file. I know how to zip the files, but my problem is that the main users html form page doesnt exist as seperate file, it...

RDCL 2008 /*Local Query*/

Hi all, I am new for RDCL 2008 format. I used RDLC 2005 format for a while and it works fine. However, recently, my company is changing to RDLC 2008 format from RDLC 2005 format. The original report rendering engine crashed. Because in RDLC 2008 format, the connection string and the query string became <ConnectString>/* Local Connection...

Row Level Revision Queries MySQL.

I currently implement some kind of version control for values in a table. I have a composite primary key between bookingId and revision. I want to be able to select all records from this table which are the head revision? I am not sure what I should be doing. [ bookingDetailsTable ] : [ bookingId ] [ revision ] [ name ] etc... SELE...

passing php variables in query strings

I have a number of url's with different query strings such as view.php?id=5 view.php?id=6 view.php?id=7 on another php page Im using file_get_contents as below: $page = file_get_contents('view.php?id=5'); $file = 'temp/form.html'; file_put_contents($page, $file); This of course only writes the first id '5', so how can i retri...

How to find the shortest distance/ travel time between two airports?

The problem was created by me, discussed with my co-workers and no one seem to have an idea. Thus, thought, I can ask the experts here. I've the following table FlightInfo and the fields are Start Destination Flight_Duration The goal is to find out, the shortest flight between two cities. The challenge is not all cities have di...

apache cassandra query/full text search

Hi everyone, I've been playing around with apache's cassandra project. Done a fair bit of readin and i have some fairly complex examples that i've done, including inserting single and batch sets of data, retrieving a single and multiple data sets based on keys. Some of the articles i've looked at include http://www.rackspacecloud.com/...

Is this query possible?

Sorry in advance for the massive queries. I've been trying and cannot for the life of me get this query to work. It's adding wins and losses to both users when two logged in users are playing against each other. (It's rock paper scissors). I can make it work for a single user, but when I try to gather a 'stats-table' summing over use...