select

MySQL SUM when using GROUP BY not working

Let's say we have this table: Symbol | Size A | 12 B | 5 A | 3 A | 6 B | 8 And we want a view like this: Symbol | Size A | 21 B | 13 So we use this: Select Symbol, sum(Size) from table group by Symbol order by Symbol ASC But instead we get this: Symbol | Size A | 12 B | 5 What am I...

Datatable select method ORDER BY clause

HI, I 'm trying to sort the rows in my datatable using select method. I know that i can say datatable.select("col1='test'") which in effect is a where clause and will return n rows that satisfy the condition. I was wondering can i do the following datatable.select("ORDER BY col1") ---col1 is the name of hte column I tried datatab...

jQuery remove SELECT options based on another SELECT selected (Need support for all browsers)

Say I have this dropdown: <select id="theOptions1"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> </select> I want it so that when the user selects 1, this is the thing that the user can choose for dropdown 2: <select id="theOptions2"> <option value="a">a</option> <option value="b">b...

MYSQL SELECT DISTINCT is not distinct in the PHP, but is distinct in the database

Hiya, I have another problem with sql queries running as I expect in PHPMyadmin, but when I add the sql to my PHP script, it does not work as expected. This is the formula of my sql: select DISTINCT table1.id AS ID, table1.title AS Title, table1.startdate AS StartDate, table1.enddate AS EndDate, ...

insert values with select

I have two tables create table p ( x number, y number, z number ); create table q ( a number, b number, c number, d varchar2(20) ); I have inserted insert into p values('1','2','3'); now i need to insert into q selecting values from p with last field getting name like Table _name in table q values such tha...

jQuery Set Selected Option Using Next

Hello, How can I, using jQuery, set the "next" item of an already selected item as "selected." For example, if I have: <select> <option value="1" >Number 1</option> <option value="2" selected="selected">Number 2</option> <option value="3" >Number 3</option> <option value="4" >Number 4</option> </select> We can see that "Number 2" i...

How to find a subset of a 2d array by selecting rows and columns in c?

In an (m by n) array stored as double *d (column major), what is the fastest way of selecting a range of rows and or columns: double *filter(double *mat, int m, int n, int rows[], int cols[]); invoked as: double *B; int rows[]= {1,3,5}; int cols[]={2,4}; B = filter(A, 5, 4, rows, cols); which is expected to return a 3-by-2 subset ...

Zend_DB_Select : why are all fields returned?

public function getWorksheetData($id) { /** create the following query using select object: SELECT wc.label, wd.notes FROM worksheet_data wd LEFT JOIN worksheet_columns wc ON wd.column_id = wc.id; */ $id = (int) $id; $select = $this->_db->select() ->from(array('wd'=>'worksheet_data'), array('wc.label','wd.notes')) ->join(arr...

DataTable Select: Expression with a space problem...

Situation: Hello! I have a little problem in a C# project. I am using the Select method from a DataTable object and using an expression to get what I want but I am having some trouble with a space in one of the strings I am using for the expression. So here is a code sample of what I have: DataTable table; //... DataRow[] rows = tab...

How do I pass struts2 <s:select multiple="true"> with a Map

I have an bean placed on my action Event.java, the action is Called ManageEvents. I would like the user to be able to add to a struts2 multiple select form field and create a list or map of items (in this case Map where the data would be . <struts2:select name="event.dj_map" label="Add DJs To Your Event" list="event.dj_map" listsize="...

how to select divs with jquery like for example in photoshop ? (select area)

hello, have some divs, on some positions. i want select them with mouse, like when are you selecting object in photoshop. so i want to select group of divs. is that possible with jquery ? thanks ...

Android Dropdown (Select) CSS

I'm currently writing some stylesheets for mobile browsers and have come across a strange issue in the Android browser. When changing the font-size CSS attribute of a text box the box gets bigger to accomodate the larger text. Doing this on a select box however does not change the size of the select box, but the text still gets larger (a...

SQL: To get all tags for a question when one is known

How can you select question_id and tags for a question when one of the tags is known? I am building a tag-search which searches questions by one tag such that the result shows the question and its tags including the one which was used in the search. I use the same tables as in this question. They are Tables questions | ...

How to: select normalized view from denormalized data using CTE?

This is a very standard newbie question, but I am looking for an expert clever way to do this with little code. (I know how to do this long hand, with procedural code and cursors, so we can skip that part of the answer.) Basically, I have a de-normalized data set for which I need to extract a normalized table in a set processing way. T...

Refilling a select box with POST data (php)

Hi all, I have a select box that shows 3 options: option1, option2, option3. When a user hits submit, then in $_POST I do have the value selected. Is there an easy way to redisplay the select box with the chosen option highlighted WITHOUT it being repeated in the options? In other words, if option2 is selected and submit is clicked...

CASE in ORDER BY few columns

Using a case-then block, I need to choose how to order my SQL 2008 query, by [status] ASC, [date] DESC or just [date] DESC. I know only how to use one column: SELECT * FROM table ORDER BY CASE WHEN @flag = 0 THEN R.[date] END DESC, CASE WHEN @flag = 1 THEN R.[status] END ASC How to use both columns in second CASE? ...

find likewise data from two tables in mysql

i have two tables in my database one is A other one is B A is having few fields in which three are id,name,group B is having feilds like id,title,description, etc. i have to search the id's of title and description that are having data similar to table A's name or group and then have to insert the id's in a field of table A. For exampl...

Determine Logic for MySQL Select - Reservation System

Hi all, I'm creating an equipment reservation (PHP/MySQL) for my school. My database looks like this: tblEvents: id start end equipID tblEquipment: id name description I'd like to know the best way to query the database based on a user's time parameters to see if a certain item is 'not available.' For example, if I have...

PHP/MySQL Reservation System

I'm currently working on an Equipment Reservation System for my school. Here's basically what my tables look like: tblEquipment: id name description 1 Camera Takes pictures 2 Projector Projects images 3 Stereo Plays music tblEvents: id equipmentID start...

Semi-Complicated PHP/MySQL Select Statement

Hello all, I currently have 3 tables, which I'm using for people to make reservations for certain pieces of equipment. Here are my tables: tblEquipment: id name description 1 Camera Takes pictures 2 Projector Projects pictures 3 Laptop Portable Computer tblEven...