spot7.org logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories

Get previous and next row from rows selected with (WHERE) conditions


Try this

SELECT *
FROM   tablename a
WHERE  ID IN(SELECT ID - 1
             FROM   tablename 
             WHERE  word = 'name') -- will fetch
previous rows of word `name` 
        OR ID IN(SELECT ID + 1
                 FROM   tablename 
                 WHERE  word = 'name') -- will
fetch next rows of word `name`
        OR word = 'name' -- to fetch the rows
where word = `name`

Categories : SQL

Related to : Get previous and next row from rows selected with (WHERE) conditions
DateTimePicker pain in the Bu.. I want to disable it if the previous conditions are not equal
I created two textboxes and placed it over the datetimepicker value and make it visible if there is not date available from the listbox :) private void AvailableMin_SelectedIndexChanged(object sender, EventArgs e) { if (AvailableMin.Text == "") { textBox2.Visible = true; textBox2.Text = "There are no to dates available for this parti

Categories : C#
Searching Access records according to different conditions selected in a form
Instead of using If-ElseIf, You can do something like this Dim checkedControls As New List(Of Control) For Each Control In Me.Controls If TypeOf Control Is CheckBox AndAlso CType(Control, CheckBox).Checked Then checkedControls.Add(CType(Control, CheckBox)) End If Next Now you have all the checked controls, Just iterate over the list to create your q

Categories : Vb.Net
Clear the previous input once the selection is selected
You can do this more easily with $watch, which is designed for this purpose. In your controller: $scope.$watch('payment.type', function (newVal, oldVal) { $scope.payment_input = 0; // anything else you want to do when the payment type is changed }) Now whenever payment.type is changed, these lines will be executed. Here are more docs: https://docs.angularjs.org/api/ng/type/$rootScope.Scop

Categories : Angularjs
How to keep the selected checkmark box selected in a TCheckListbox control after using the .Move() method
You should use a method for calculating the new index and another for moving and follow the item. Then you will have a more speaking, DRY and reuseable for any control derived from TCustomListBox code: procedure TForm1.MoveAndFollow( ListBox : TCustomListBox; OldIndex, NewIndex : integer ); begin ListBox.Items.Move( OldIndex, NewIndex ); ListBox.ItemIndex := NewIndex; end; procedure TForm1.M

Categories : Delphi
how to return position of spinner so that the selected option can be selected again
As per document, Spinner's onItemSelected Callback method to be invoked when an item in this view has been selected. This callback is invoked only when the newly selected position is different from the previously selected position or if there was no selected item.

Categories : Android
Recently Add
SQL command to insert two primary keys into third table
How to do a registerform by ASP.NET VB SQL
Shortest time and trip between two stops across many trip options (GTFS)
Using IN and EXISTS subquery with AND operation instead of OR?
How to select multiple alias columns from the same table
Delete records from a given table
date manipulation in postgresql
PSQL query with join query from a db newbie
Protect LocalDB from user access
Update field with combined contents from other fields
SQL select unique records under certain priority and conditions from multiple columns
Multiply quantities for all parent child relationships
I'm having an issue running a query from a batch file
Concatenate strings while filtering by another column in SQL Server view
Parsing Dynamic XML to SQL Server tables with Parent and child relation
Using MERGE for delete and insert in oracle
how to display the pre value and post value of a column after updating it?
sql loop to fill up date between two time stamps
With SQL/TSQL, how can I use STUFF within this WHILE clause?
Challenging db table and query
Query to fetch row corresponding to Max value in SQL
Oracle SQL - ORA-00936 on DATE()
how to split single row into multiple row in db2?
Combine fields into one column
How can I perform an SQl where query then list properly?
SQL - Selection of the oldest order for every customer (join two tables)
Sum two counts in a new column without repeating the code
Creating multiple sum fields based upon criteria in another field in MS access 2007
Grouping by two values in same table
MS SQL last record
© Copyright 2017 spot7.org Publishing Limited. All rights reserved.