select

What can cause 'rows affected' to be incorrect?

Using Microsoft SQL Server Management Studio 2008. I have done a simple transaction: BEGIN TRAN SELECT ko.ID, os.ID AS ID2 FROM table_a AS ko JOIN table_b AS os ON os.ID=ko.ID WHERE (ko.the_date IS NOT NULL AND os.the_date IS NULL); UPDATE table_b SET the_date=ko.the_date FROM table_a AS ko JOIN table_b AS os ON os.ID=ko.ID WHERE (ko....

Searching for newlines in a Oracle DB using SQL 'like' clause

I'm trying to see if a particular column in a table in my Oracle database has any strings which contain a newline character, so a wildcard, a newline, and another wildcard. I've tried the like command and a combination with CHR(10) and tried escaping the newline itself, but to no avail. What would be the proper way to detect a newline ...

sql (oracle) to select the first 10 records, then the next 10, and so on

I figure I might just be missing some obvious syntax but what is the sql (oracle) to select the first 10 records, then the next 10, and so on? I tried using rownum but can seem to get rownum > X and rownum < Y to work. llcf ...

get data from datetime's column

lets say I have a "Datetime" column in DB. It has a data like "2010-10-01 09:12:00". Beside that, i want to make a searching page which have: <select id="month" name="month"> <option value="01">01</option> <option value="02">02</option> ... </select> <input type="text" id="year" name="year"> How do i do to get dat...

I'm looking for an example on how to use select.select() with subprocess to monitor stdout

Basically, I have an application that is loaded using p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) I can send it commands using p.stdin.write() without any trouble, but I need to monitor stdout for server responses. this whole thing is running inside a tcp server, so I need to know ...

Case Statement Question -- vb.net

So I have case statements grouped together here, but I have a few case statements that need extra decision based on a second variable after the original case is confirmed. This is what I have now: Case "PRIVATE_PARTY" If Condition = KBB_CONDITION_EXCELLENT Then Vehicle.MarketValue = Response.PrivatePartyExcellent ElseIf...

MySQL: Join two tables, select one row at random.

First off, I created a screen cast, in order to explain what I have and what I'm attempting to create. Much easier to understand. Please view the screen cast here: http://www.youtube.com/v/lZf3S3EGHDw?fs=1&amp;hl=en_US&amp;rel=0&amp;hd=1 Tables: CREATE TABLE `locations` ( `id` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(45) D...

Help debugging sql query: where do I have an extra ( or )?

This query works: SELECT u.UserId, u.GroupId, u.username, gp.PreferenceId, gp.Properties, gp.Override FROM dbo.UserTable u Inner JOIN dbo.GroupPreferences gp ON gp.GroupID = u.GroupId WHERE (u.UserName = 'myUserId') But the same query inside another query doesn't. I ge...

How can I select the latest of three value types in a MySQL database?

Here is an example table: ID time data type 0 0100 xyz 0 1 0200 xyz 1 2 0300 xyz 1 3 0400 xyz 2 4 0200 xyz 0 5 0500 xyz 2 6 0300 xyz 0 Data is added based on timestamp so that the last of each type has the latest time stamp. I would like the result of a SELECT to b...

How can I merge two outputs of two Linq queries ?

I'm trying to merge these two object but not totally sure how.. Can you help me merge these two result objects? // // Create Linq Query for all segments in "CognosSecurity" // var userListAuthoritative = (from c in ctx.CognosSecurities where (c.SecurityType == 1 || c.SecurityType == 2) ...

Should I use a T-SQL function, view, or stored proc ?

Hi Guys, I've got a question about reusing table data but a view won't work in this scenario as I have a parameter that needs to be passed in. Basically this part of the system requires a travellerid to be sent to the procedure and a list of arrangers returned for that specific traveller. There are around 7 business rules that are used ...

how do i combine two selects from one table where one has a GROUP BY and the other has a DISTINCT

Both of these work individually SELECT PONumber, count(RequestNumber) as "InNumOfRequests", sum(Amount) as "SumofAmounts" FROM tableView GROUP BY PONumber SELECT DISTINCT PONumber, (10 * ceiling((DATEDIFF(day,POApprovedDate,GETDATE()))/10)) AS "BINofDaysSincePOApproved" ...

Select most recent from mysql table

I have two mysql tables: Item containing items that one can buy: CREATE TABLE `item` ( `itemid` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(50) DEFAULT NULL, PRIMARY KEY (`itemid`) ) ENGINE=InnoDB; Purchase containing all purchases: CREATE TABLE `purchase` ( `purchaseid` int(11) NOT NULL AUTO_INCREMENT, `date` date DEFAU...

html - controlling how many options show in a select element

So I have a drop down (select) element. The problem is that if there is a long list in it, then it "drops" upwards instead of downwards. Is there a way to say that it should scroll rather than show all of them at once? I know there's "size" but that's how many are visible at once (I only want one visible, like normal) Or is the reason...

What is select supposed to do if you close a monitored fd?

I can test this to find the behavior but that's not the point. In my answer to another question, a commenter recommended closing a monitored fd from another thread to wake up select. Another commenter couldn't find a reference to this behavior in the standard, and I can't find one either. Can someone provide a pointer to the standard on...

SQL Select Return Default Value If Null

Database: MS SQL 2008 SELECT Listing.Title, Listing.MLS, Pictures.PictureTH, Pictures.Picture, Listing.ID FROM Listing INNER JOIN Pictures ON Listing.ID = Pictures.ListingID WHERE (Pictures.ID = (SELECT MIN(ID) FROM Pictures WHERE (ListingID = Listing.ID))) The issue is, I have several "Listings" without a Picture, and because of thi...

carry some extra information in an HTML select/option dropdown list

I want to carry some extra hidden information (eg: postal code) in an HTML select/option dropdown list and make it available to a javascript function when user changes option box selection. This is the type of thing I would like to do (but alas it does not work). Can someone fix it or suggest reasonable alternative? <select id="s...

How do I use PHP to populate a second select-tag with options based on the option selected in the first select-tag?

I will draw the options for the second select-tag from a database. Thanks. ...

once you select an item on a multiselect html listbox, is there anyway to deselect all

My users can't seem to deselect all on a select in html. I have a basic multiselect listbox in html: <select class="longDropdown" id="SelectedCalendars" multiple="multiple" name="SelectedCalendars"> <option value="13">ER</option> <option selected="selected" value="26">Billy 123</option> <option selected="select...

mysql retrieve partial column

I am using TinyMCE to allow users to write in what will eventually be submitted to a database. TinyMCE includes a button which will insert a "pagebreak" (actually just an HTML comment <!--pagebreak-->). How can I later pull back everything up to the first occurrence of the pagebreak "tag"? There might be a significant bit of data after...