select

SQL: Is a query like this OK or is there a more efficient way of doing it, like using a join?

I often find myself wanting to write an SQL query like the following: SELECT body FROM node_revisions where vid = (SELECT vid FROM node WHERE nid = 4); I know that there are joins and stuff you could do, but they seem to make things more complicated. Are joins a better way to do it? Is it more eff...

How to populate dynamically generated select boxes with ajax

Hi - I haven't been able to find a solution for the particular problem I'm having with this project. I need to the following: dynamically add rows to a table that contain two select boxes AND use ajax to auto-populate the select options of the 2nd select box, based on the value of the first select box... in the respective table row (that...

How do I echo selected in a while loop?

Hello, I have a blogs and questions section on my site that has categories. When a user composes a question or a blog, there is a drop down menu that allows you to choose your category. When you edit either of these you have the option of changing your category via the dropdown. When you go to edit a blog,the category drop down is a stan...

How to select multiple fields in the same row? (MySQL)

I asked a question yesterday about using MySQL to tally results to a survey. Now my question is, if I had a table of survey questions, a table of survey choices, and a table of users answers to those survey questions, how would I select the survey question along with all the choices for that survey within the same query? Questions Tabl...

How to select results between two dates or by single year/month/day in oracle? (to_date, extract,sysdate)

I have a table for orders and it has 2 column with DATE types: delivery_date and order_date. In my sqldeveloper, all the dates I've inserted via Java or by hand are in the format 10.01.25 for the 25th Jan of this year. When I try to see the the total_price for orders between one date and another, I force the format like this: create...

Select area on camera view on iphone

Hello! I am really new to iphone programming and I am trying to build an application that uses camera live view to select a rectangle by touch events. I want to store the pixels in that rectangle in a pointer. Can anyone help me out with this code? Thank you! ...

Named pipe is not flushing in Python

I have a named pipe created via the os.mkfifo() command. I have two different Python processes accessing this named pipe, process A is reading, and process B is writing. Process A uses the select function to determine when there is data available in the fifo/pipe. Despite the fact that process B flushes after each write call, process A's...

[if and onlf if] in a select statement in sql server 2005

How to use if and onlf if in a select statement in sql server 2005? Here is my select statement select Mat_Id,MeasurementId from InTime... Now i want to show measurementName which is Measurment Table based on MeasurementId.. Mind you MeasurementId is not a foriegn key... How to make join with Measurement table if there is value in...

Concat two column in a select statement sql server 2005

How to Concat two column in a select statement sql server 2005? Here is my statement Select FirstName,secondName from Table... Now i did try concating secondName with FirstName by using Select FirstName + ' ' + secondName from Table But some values are NULL in secondName column for some records.. My select statement returns NULL i...

If not exists statement in sql server 2005

How to write if not exists statement in sql server 2005 for the following condition If @MeasurementId say values (1,2,3) those are the existing values the below statement work but when @MeasurementId=0 it doesn't seem to work... If not exists(select Mat_Id,MeasurementId from MaterialQuantity where Mat_Id=@Id and MeasurementId=@Measur...

Adding an Option to a Select Element with javascript using the Prototype library

Hey Guys n Gals! Want a to add an option dynamically to an Select element using prototype. There seems to be a lot of different ways to do it out there, all to do with options.add etc... Not seen much in the way of cross-browser ways. Want it to be as light-weight as possible. This is what I have got so far. It's just the appending ...

HTML. Editable 'Select' element

I would like to have a select element in the form but besides the options in the dropdown, it would be useful to be able to edit it and add new option but not with another input text, I need all in once. Is it possible? ...

SQL View. Select count... Where...

I am most confused with this one, so i d better ask the experts! These are the rows returned by a custom query of mine. Col1 Col2 Result Font Bold a Font Bold b Font Bold a Font Italic a Is there any way of using selecting count in the above (table) results in order getting this one? Col1 Col2 ResultA ResultB ...

jQuery Validation doesn't highlight my select field on error *solved

Hey everyone, I am trying to apply a drop down validation (so if the value is equal to 0 of a <select><option value="0">) then it applies a background-color of yellow as it does for the rest of my input fields. Here is my code: <script src="jq.js"></script> <script src="validate.js"></script> <script> jQuery.validator.addMethod( "sel...

Using jQuery to disable multiple selects.

Hey folks. I have 7 select menus. I want to have the user make three choices, leaving 4 select menus disabled. Here is the link: http://www.missionsolano.org/support_volunteer_form.php (under Areas of Interest). I open to using jQuery form validator plugins as well. Anyone have any tips? ...

CheckBoxList select all options in jQuery

I have a CheckBoxList and one of the options is 'All'. I want to select all the options including All if the user checked 'All' and if the user unchecked 'All', I want to clear selections. If they select any other option except 'All', do nothing. Can anyone help me with jQuery to do this? I am using jQuery 1.2.6 <table border="0" oncli...

Dependent MySQL SELECT

My problem is the following: My tables are MESSAGE and MESSAGE_COMMENT, MESSAGE (id,content) MESSAGE_COMMENT (id, message_id, content) I need to select all messages and max 3 comments for each message, like in this example: type | id | content M 15 "this is a message with no comments" M 16 "this is another message wit...

mysql duplicate data deletion

This shows me all the first names and last names that have exactly two entries that are identical SELECT `firstname`,`lastname`,COUNT(*) AS Count FROM `people` GROUP BY `firstname`,`lastname` HAVING Count = 2 How do I turn this into a DELETE FROM WHERE statement with a LIMIT to only remove one of each of the entries and leave the o...

Selecting k*k subarray from p*p*n array in Fortran

Hi, I have a p*p*n array in Fortran, and I want to extract k*k subarray from that bigger array. I tried like this, but not sure does it work: do i=1,p vp(i)=i end do help=y(1:p,t)*vp do t = 1, n A(1:k,1:k,t) = B(pack(help,help>0), pack(help,help>0), t) end do where y contains values 0 and 1, 1 meaning that row/column is wanted...

Why is windows select() not always notifying thread B's select() when thread A closes its end of a socket pair?

Hi all, A situation I have under Windows XP (SP3) has been driving me nuts, and I'm reaching the end of my tether, so maybe someone can provide some inspiration. I have a C++ networking program (non-GUI). This program is built to compile and run under Windows, MacOS/X, and Linux, so it uses select() and non-blocking I/O as the basis f...