I can't seem to get this one right at the moment.
I want distinct records but I need other attributes to come along with the results of the find method. Current nonworking code is:
Visit.find(:all, :select => "user_id, DISTINCT cookie")
...
I have a table bike_to_owner. I would like to select current items owned by a specific user.
Table structure is
CREATE TABLE IF NOT EXISTS `bike_to_owner` (
`bike_id` int(10) unsigned NOT NULL,
`user_id` int(10) unsigned NOT NULL,
`last_change_date` date NOT NULL,
PRIMARY KEY (`bike_id`,`user_id`,`last_change_date`)
) ENGINE=...
I can't for the life of me figure out this Sqlite syntax.
Our database contains records like:
TX, Austin
OH, Columbus
OH, Columbus
TX, Austin
OH, Cleveland
OH, Dayton
OH, Columbus
TX, Dallas
TX, Houston
TX, Austin
(State-field and a city-field.)
I need output like this:
OH: Columbus, Cleveland, Dayton
TX: Dallas, Houston, Austin
...
How to make <option selected="selected"> set by MySql and PHP?
My code:
echo '<select>';
$tempholder = array();
$rs = mysql_query("SELECT * FROM id ORDER BY year");
$nr = mysql_num_rows($rs);
for ($i=0; $i<$nr; $i++){
$r = mysql_fetch_array($rs);
//if($year==$r["year"]){ $selected=' selected="selected"'; }//doesn't work so
...
I have 2 tables, that look like:
CustomerInfo(CustomterID, CustomerName)
CustomerReviews(ReviewID, CustomerID, Review, Score)
I want to search reviews for a string and return CustomerInfo.CustomerID and CustomerInfo.CustomerName. However, I only want to show distinct CustomerID and CustomerName along with just one of their CustomerRevi...
Hi,
Just getting my head around Linq and having lots of fun! Can any one aid me with a query for this:
I have a list of data:
Key Value
Aaa 12
AaA 10
AAa 5
BBB 2
Bbb 1
1. I want to group by Key.ToUpper()
2. For every group I need the Max(Value) & Sum(Value)
3. For every group I want to select the entries
T...
I am selecting records based on two dates in a same column but my where condition fails to select records on the StartDate and EndDate...
where CreatedDate between @StartDate and @EndDate
I get only the records inbetween the dates and not the records on the StartDate and EndDate... Consider if I pass the same date as StartDate and EndD...
If you know about sakila sample database, then what is the statement to select items currently rented by a user.
If not here is a code explanation:
CREATE TABLE IF NOT EXISTS `rentals` (
`item_id` int(10) unsigned NOT NULL,
`user_id` int(10) unsigned NOT NULL,
`last_change_date` date NOT NULL,
PRIMARY KEY (`item_id`,`user_id`,`la...
Hello,
I've a select based server. Sockets are in blocking mode,but for select() function I'm using 250 ms. timeout.
Basically my server accepts only one client and sending data to that client.
It is working for weeks without problem if I just send data from server to client.
But I realized that if client sends data to server after 3-4...
Here is my code ..tell me what is wrong, it doesn't work.
<Script>
$('#colorselector').change(function(){
$('.colors').hide();
$('#' + $(this).val()).show();
});
</Script>
<Select id="colorselector">
<option value="red">Red</option>
<option value="yellow">Yellow</option>
<option value="blue">Blue</option>
...
Hey!
I am using the following code to select from a MySQL database with a Code Igniter webapp:
$query = $this->db->get_where('mytable',array('id'=>10));
This works great! But I want to write the following MySQL statement using the CI library?
SELECT * FROM `mytable` WHERE `id`='10' OR `field`='value'
Any ideas?
Thanks!
...
I have an application that runs on embedded linux (older kernel, 2.6.18). I'm using Live555. Occasionally when the camera is heavily loaded, my RTSP server (built using Live555) will hang indefinitely--no amount of connecting or cajoling seems to get it to snap out of it, short of resetting the application.
I narrowed the hang down to...
Hi,
I'm trying to render sliders instead of select components.
Each page has several select components marked with class='jqselect' and all of them will have decreasing year values (some years may be missing).
Eg. a select may have values [2010, 2009, 2006, 2005, 2004].
I have tried binding it both following the examples in the jQuery...
Hi,
I have a database "temp" with table "A". I created new database "temp2".
I want to copy table "A" from "temp" to a new table in "temp2" . I tried this statement but it says I have incorrect syntax, here is the statement:
CREATE TABLE B IN 'temp2'
AS (SELECT * FROM A IN 'temp');
Here is the error:
Msg 156, Level 15, State 1, Li...
Why editable-select list plugin<select><option>value</option>doesn't work with latest jQuery?
editable-select code:
/**
* Copyright (c) 2009 Anders Ekdahl (http://coffeescripter.com/)
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licen...
I have a question.Here is the code!
f.select(:departments,Department.all.collect{|c|[c.name,c.id]},{},:size=>10,:multiple => ture)
class Emergency
has many :departments
end
the html source like this:
<select id="emergency_departments" multiple="multiple" name="emergency[departments][]" size="10"><option value ="">""</opt...
Hi,
I have a list like this:
City Total
Sydney 11
Dublin 9
London 12
Dublin 3
London 9
Sydney 12
I first of all need to Group By City & Sum Total so I have
Sydney 23
Dublin 12
London 21
Next I need to filter for those that entries where the total is > 20
Sydney 23
London 21
And what I finally need is the total of these entrie...
In Drupal 6 - Our default select box is the "Ajax - autosuggest" variation. This shows up in Location and Views modules amoung other places.
Is there a place where we can set this to the regular select-dropdown type of select box?
...
Hi, the following query
CREATE TABLE IF NOT EXISTS XY (
x INT NOT NULL ,
y FLOAT NULL ,
PRIMARY KEY(x)
)
INSERT INTO XY (x,y)
(select 1 as x ,(1/7) as y);
errors with
Error code 1064, SQL state 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use ne...
I'm currently working on a project which involves multiple clients connected to a server and waiting for data. I'm using select and monitoring the connection for incoming data. However, the client just continues to print nothing, acting as if select has discovered incoming data. Perhaps I'm attacking this wrong?
For the first piece of d...