select

sql ms access select by date and genre

I have two tables: fID Enamn Fnamn bdate 1 Ronge Paus 49-05-14 2 Nesser Håk 50-07-26 3 Bods Thomas 51-05-02 And ISBN cathegory 123 Prosa 456 Poesi 789 Thriller I am trying to select by date and cathegory. The writer shoult be born before year "1950" and the cathegory should be "Poesi" The result should be: ISBN ...

Howto Select rows that match the intersection of multiple rows in other tables in MYSQL?

It seems complicated (and probably it is). But i cant imagine how to solve this. There are tables: COMPANIES id | name 1 | Google 2 | Samsung 3 | Microsoft PARAGRAPHS id | name 1 | Header 2 | Body 3 | Footer TAGS id | tag 1 | Internet 2 | Softwate COMPANIES_VS_TAGS id | company_id | tag_id 1 | 1 | 1 2 | 2 | 2 3 | 3 | 1 4 | 3 |...

How to Rank in MySQL Using a WHERE clause and UNION ALL

I need some help with a MySQL query. I'm trying to rank participants using a WHERE clause. So, I'd like to rank novices, intermediates, and experienced separately. For example: Rank Name Grade Type ---------------------------------- 1 Bob 98 Novice 2 Jill 88 Novice 3 Jimmy 42 Novice 1 Mark 87 ...

MySQl : How to Exclude Row in a Ranking Sub-query

Hi, I've got a mySQL statement that selects some data and also ranks. I want to have the record for 'Bob', for example, selected but NOT included in the ranking. So, I need Bob's row returned in the main select statement, but I need Bob excluded from the sub-SELECT which handles the ranking. I needs Bob's data but, he should not be co...

mysql subquery in single table

Hi, I have 2 columns in an "entries" table: a non-unique id, and a date stamp (YYYY-MM-DD). I want to select "all of the entry id's that were inserted today that have never been entered before." I've been trying to use a subquery, but I don't think I'm using it right since they're both performed on the same table. Could someone help me ...

Passing array from JSP to Javascript(how to create a matrix in javascript)

Hello, i get a list from my java code and I would like to create a matrix from this list. In my jsp I have a select and I would like to display in a table the values of my matrix in relation to value in my select choice my list in my java <html:select property="immeuble.zone" size="1" styleId="zone" styleClass="saisie"> <html:opti...

Select tag is not rendering on Jsp

Before this i have used the struts 2 select tag successfully, but i am stuck to a problem now, my jsp is throwing an exception due to the select tag, i have created an array list which i am passing to the 'list' attribute of select tag, i have also defined getters & setters for that list and also for the name property element of the sele...

Which option is selected in jQuery 1.2?

Finding out the current value of a select-list with jQuery 1.4 is easy: $('#selectList').val(); But whats about jQuery 1.2? I get an "undefinied". I also tried $('#selectList:selected').val(); $('#selectList option').val(); $('#selectList option:selected').val(); Nothing works but for this project i have to use jQuery 1.2 ...

SELECT IN for a large set

In my web application, I want to find out which of a user's friends on Twitter are already existing on the system... Currently what I am doing is getting the list of Twitter IDs the user is following (Twitter API returns the IDs 5000 at a time), and doing: SELECT userId FROM users WHERE userId IN (COMMA_SEPARATED_LIST_OF_IDs); I don't...

PHP MYSQL order by day and month...HELP please..

Hi i have my mysql $query = mysql_query('SELECT * from rbf_edades_news order by month DESC '.$limit.''); month and day are in different fields, any idea?" is this possible $query = mysql_query('SELECT * from rbf_edades_news order by month and DESC '.$limit.''); Thanks! ...

SQL: how to use column name from an outer clause in an inner clause?

How can I use the value from an outer clause inside an inner clause using nested SELECT statements? Eg: SELECT cost AS c, quantity, (SELECT COUNT(1) FROM accounts WHERE cost = c) FROM accounts Can c be referenced in the inner SELECT clause as attempted above? ...

This SELECT query takes 180 seconds to finish

UPDATE: Just to mention it on a more visible place. When I changed IN for =, the query execution time went from 180 down to 0.00008 seconds. Ridiculous speed difference. This SQL query takes 180 seconds to finish! How is that possible? is there a way to optimize it to be faster? SELECT IdLawVersionValidFrom FROM question_law_versio...

Any popular Rails tricks for keeping a nav's css selected when flipping through partials?

I have an admin with a nav. The nav toggles between different partials. The nav has several li's, and when one of them is selected, it gets the .selected class that makes it highlighed. Is there anyway to toggle this from the controller? Or any other place that's popular among Rubyists? ...

jQuery event delegation for select/options in Chrome

I am trying to bind a simple click event to an the selected option of a pulldown. $('select#myselect').delegate(':selected', 'click', function() { alert('selected'); }); This code works in Firefox, but not Chrome/Safari. Can I use the .delegate() to bind an option for a pulldown menu like this? If so, how? If not, what is...

Dynamically size a select list (Safari)

I would like to size a select list based on the width needed for the selected index(string). Say for example I have a list with 3 strings, short, medium, loooooong; I don't want the select list to automatically be as wide as its largest element, rather it should be as wide as its selected element. The first method I tried: document.getE...

MYSQL: Instead of using SELECT statements in a while loop - what are my options?

I have a table which contains a list of categories and and another table which contains a list of products in each category. e.g. CatID | Cat_Name ---------------- 1 | Books 2 | CDs and ProductID | Product_Name | CatID ------------------------------------ 1 |The Bible | 1 2 |The Koran | 1 ...

Struts2 escaping select values

I have text in a option (using a select tag) that has multiple spaces. These spaces are then converted into one space. I then tried to escape the spaces with &nbsp; but it then converts it to: which is not what I want. Is there anyway to disable escaping in Strut2 or have it always escape spaces for me for select tags? There is a ...

how to return multiple rows of a single column separated by a ',' or html break in TSQL?

the sql query : SELECT coloumn1 FROM tablex WHERE id=10 and state='COL' lets assume the above query retuns the following coloumn1 --------- abc def geh ijk i need the result to be like this coloumn1 --------- abc, def, geh, ijk OR coloumn1 --------- abc<br/>def<br/>geh<br/>ijk how can achive a result set like the above? PLZ!h...

Help me rewrite this query

I have this query: SELECT diamond_id, carat, clarity, color, cut, CASE clarity WHEN "FL" THEN 0 WHEN "IF" THEN 1 WHEN "VVS1" THEN 2 WHEN "VVS2" THEN 3 WHEN "VS1" THEN 4 WHEN "VS2" THEN 5 WHEN "SI1" THEN 6 WHEN "SI2" THEN 7 WHEN "I1" THEN 8 WHEN "I2" THEN...

Add further information to Rails Select list?

Hi Everyone, I have a select list drop down in my Rails application, in the form for creating a new record. <li>Surveyor Name<span><%= f.select :surveyorperson_id, Person.all.collect { |x| [x.personname, x.id]}, {:selected => (@kase.surveyorperson_id rescue "")} %></span></li> This is so the user can choose from a list of Surveyor's ...