I had a table (Some_Table) with two columns:
A B
-------------------
1 test
2 test
3 test1
4 test1
i would like to return DISTINCT values for column B and it's associated value in column A (first in distinct set), so something like this:
A B
-----------
1 test
3 test1
What is the sql?
I have a single MYSQL Question and need help ASAP.
Database:
Email | Name | Tag
[email protected] |Test Person | TagOne
[email protected] |Test Person | Tag Two
Need an SQL query that will return
Email | Name | Tag
[email protected] |Test Person | TagOne, Tag Two
Any help?
Under
(BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)
peoplePicker
shouldContinueAfterSelectingPerson:(ABRecordRef)person
property:(ABPropertyID)property
identifier:(ABMultiValueIdentifier)identifier{}
is it possible to get returned the phone number or somewhat the user has clicked?
how can I extract the first 2 C-Values ('Baby' and 'Cola') where B is 'RED'. Input instance is:
<Root>
<A>
<B>BLACK</B>
<C>Apple</C>
</A>
<A>
<B>RED</B>
<C>Baby</C>
</A>
<A>
<B>GREEN</B>
<C>Sun</C>
</A>
<A>
<B>RED</B>
<C>Cola</C>
</A>
<A>
<B>RED</B>
<C>Mobile</C>
</A>
</Root>
Output instance must be:
<Root>
<D>Baby</D>
<D>Cola</D>
</Root>
I thought about the combination of for-each and global variables. But in XSLT it is not possible to change the value for a global variable to break the for-each. I have no idea anymore.
I have an ASP.Net webpage where the user selects a row for editing. I want to use the row lock on that row and once the user finishes the editing and updates another user can edit that row i.e. How can I use rowlock so that only one user can edit a row?
Thank you
Below is my example script:
<li><a <?php if ($_GET['page']=='photos' && $_GET['view']!=="projects"||!=="forsale") { echo ("href=\"#\" class=\"active\""); } else { echo ("href=\"/?page=photos\""); } ?>>Photos</a></li>
<li><a <?php if ($_GET['view']=='projects') { echo ("href=\"#\" class=\"active\""); } else { echo ("href=\"/?page=photos&view=projects\""); } ?>>Projects</a></li>
<li><a <?php if ($_GET['view']=='forsale') { echo ("href=\"#\" class=\"active\""); } else { echo ("href=\"/?page=photos&view=forsale\""); } ?>>For Sale</a></li>
I want the PHP to echo the "href="#" class="active" only when it is not on the two pages:
?page=photos&view=forsale
or
?page=photos&view=projects
I have a contracts table:
contractId date price partId
1 20120121 10 1
2 20110130 9 1
3 20130101 15 2
4 20110101 20 2
The contract with greatest date being the active contract (don't blame me, I blame infor for creating xpps)
I need to create query to see only active contracts (one contract per part, the contract with highest date).
So the result of the query should be like this:
contractId date price partId
1 20120121 10 1
3 20130101 15 2
I am out of ideas here, I tried self joining the table, I tried aggregation functions, but I can't figure it out. If anyone would have any idea, please share them with me..
I am having trouble with a ListView I created: I want an item to get selected when I click on it.
My code for this looks like:
protected void onResume() {
...
ListView lv = getListView();
lv.setOnItemSelectedListener(new OnItemSelectedListener()
{
public void onItemSelected(AdapterView<?> adapterView, View view, int pos, long id) {
Log.v(TAG, "onItemSelected(..., " + pos + ",...) => selected: " + getSelectedItemPosition());
}
public void onNothingSelected(AdapterView<?> adapterView) {
Log.v(TAG, "onNothingSelected(...) => selected: " + getSelectedItemPosition());
}
});
lv.setOnItemClickListener(new OnItemClickListener()
{
public void onItemClick(AdapterView<?> adapterView, View view, int pos, long id) {
lv.setSelection(pos);
Log.v(TAG, "onItemClick(..., " + pos + ",...) => selected: " + getSelectedItemPosition());
}
});
...
}
When I run this and click e.g. on the second item (i.e. pos=1) I get:
04-03 23:08:36.994: V/DisplayLists(663): onItemClick(..., 1,...) => selected: -1
i.e. even though the OnItemClickListener is called with the proper argument and calls a setSelection(1), there is no item selected (and hence also OnItemSelectedListener.onItemSelected(...) is never called) and getSelectedItemPosition() still yields -1 after the setSelection(1)-call.
What am I missing?
Michael
PS.: My list does have =2 elements...
Hi!
I have a collection of elements of type B and C, which all extends A. I need to filter the collection to get elements of only B type.
Is there any way to do it except:
for (A a : initCollection) {
if (a instance of B) {
newCollection.add(a)?
}
}
Thanks
Say I have an unordered list like so:
<ul>
<li>Some Text</li>
<li>Some Text</li>
<li>Some Text</li>
<li>Some Text</li>
</ul>
I want to use jquery so that when I click a "li", the background changes to blue. So I do this:
$('li').click(function() {
$(this).addClass('active');
});
And the "active" class has as background of blue. However, I can't figure out how to make it so that when I click another "li", the other "li" that has a background of blue stops having a background of blue. I guess what I'm trying to say is how to make only one "li" have a background of blue at a time--using jquery.
a.2<-sample(1:10,100,replace=T)
b.2<-sample(1:100,100,replace=T)
a.3<-data.frame(a.2,b.2)
r<-sapply(split(a.3,a.2),function(x) which.max(x$b.2))
a.3[r,]
returns the list index, not the index for the entire data.frame
Im trying to return the largest value of b.2 for each subgroup of a.2. How can I do this efficiently?
I have the following tables/columns:
Parent:
ParentID
Child:
ChildID
ParentID
SubChild:
SubChildID
ChildID
Date
Parent has 1 to Many relationship with Child
Child has 1 to Many relationship with SubChild
For every Parent, I need to get the SubChild with the most recent Date value.
How can I do this using SQL. I've tried using MAX(Date),
but I can't seem to figure out how to join Parent and Child successfully.
The ideal result set would contain all the Parents joined with all the SubChild columns of the latest record.
Note: using MS SQL 2005+
Hello,
I want to hide and show some form in my page.
For each form theres a link, and i want that, when i click on this link,
it hide and show the nearest form of the link.
My code looks like this :
$$('.flagLink').each(function(s){
$(s).observe('click', function(event) {
// here i want to hide and show the nearest form
});
});
I've tried this :
$$('.flagLink').each(function(s){
$(s).observe('click', function(event) {
$(s).next('form').toggle();
});
});
It works but, i would like to be more precise like :
$$('.flagLink').each(function(s){
$(s).observe('click', function(event) {
$(s).next('.flagForm').toggle();
});
});
but the .flagForm selector doesnt work.
hello, i have following function:
function delete_auswahl()
{
var anzahl =document.getElementById ("warenkorbfeld").length ;
for (var i =0; i<=anzahl; i++)
{
if (document.getElementById ("warenkorbfeld").options[i].selected==true)
{
if (document.getElementById ("warenkorbfeld").options[i].id == "Margherita" )
gesamtbetrag = gesamtbetrag - 4;
if (document.getElementById ("warenkorbfeld").options[i].id=="Salami" )
gesamtbetrag = gesamtbetrag - 4.50;
if (document.getElementById ("warenkorbfeld").options[i].id=="Hawaii" )
gesamtbetrag = gesamtbetrag - 5.50;
document.getElementById ("warenkorbfeld").options[i]=null;
i--;// auf der gleichen stelle bleiben, da dass nächste feld nachrückt
}
}
document.getElementById('gesamtbetrag').innerHTML=gesamtbetrag ;
}
before i added values with
function hinzu (pizza)
{
NeuerEintrag = new Option(pizza, pizza, false, false);
document.getElementById("warenkorbfeld").options[document.getElementById("warenkorbfeld").length] = NeuerEintrag ;
if (pizza=="Margherita")
{
gesamtbetrag = gesamtbetrag + 4;
}
if (pizza=="Salami")
{
gesamtbetrag = gesamtbetrag + 4.50;
}
if (pizza=="Hawaii")
{
gesamtbetrag = gesamtbetrag + 5.50;
}
document.getElementById('gesamtbetrag').innerHTML=gesamtbetrag ;
}
now, in the delete function doesn't substract the price.
despite this, all works.
what's wrong with this term?
if (document.getElementById ("warenkorbfeld").options[i].id == "Margherita" )
gesamtbetrag = gesamtbetrag - 4;
thanks in advance
I am in need of a jquery based 360 rotational slider I want the user to be able to grab the end and rotate it 360 degrees anyone know of anything like that I can't seem to find one
I have an architecture similar to this:
<div id="container">
<div>stuff here</div>
<div>stuff here</div>
<div>stuff here</div>
<div>stuff here</div>
</div>
I want to, using jQuery, hide the cursor when the mouse enters #container. However as the nested divs appear on top it doesn't quite work that way. How can I hide the mouse cursor when hovering over any of the divs within #container. Below is the cursor hiding code.
$('#container').mouseover(function()
{
$(this).css({cursor: 'none'});
});
Hi all. Please be gentle, I'm still learning. I imagine that the solution to my problem is simple and that perhaps I have just been in front of the computer too long.
I am trying to detect the size of the viewport, and then use a different sized image for a background on an element depending on the size of the viewport.
Here is what I have so far:
$(document).ready(function(){
var pageWidth = $(window).width();
if ( pageWidth <= 1280 ) {
$('#contact').css('background-image', 'url(../images/contact_us_low.jpg)');
}
elseif ( pageWidth > 1280 ) {
$('#contact').css('background-image', 'url(../images/contact_us_high.jpg)');
}
});
Error:
missing ; before statement
[Break on this error] elseif ( pageWidth 1280 ) {\n (Line 7)
To me it seems like all of my semi-colons are in the right place. Two questions:
Am I going about solving the problem in a sensible way? To me a simple conditional should solve this background problem, as the code is merely selecting between two images based on what size it detects the viewport to be.
Can you please help point out my n00b syntax error? Sometimes it really does help to have an extra pair of eyes look at something like this, even if small.
Thank you kindly for your advice, I will continue poking and perusing the docs I have available to me.
So I have this table of book orders, it contains 2 columns, one is the order ID(primary key) and another is the ID of the book that the customer ordered. For example:
| OrderID | BookID |
| 0001 | B002 |
| 0002 | B005 |
| 0003 | B002 |
| 0004 | B003 |
| 0005 | B005 |
| 0006 | B002 |
| 0007 | B002 |
What I want is to get the IDs of the books that got 2 or more purchases/orders, for example if I run the SQL query against the above data, I would get this as the result:
| BookID |
| B002 |
| B005 |
I don't know if this can be archived in SQL or I have to built a simpler statement and repetitive run the query against all the records in another language. I need some help and thanks for reading my question.
How can I query a table which has a column of data type HIERARCHYID and get a list of descendants X levels deep under an employee?
Here is the current structure:
CREATE TABLE [dbo].[Employees](
[NodeId] [hierarchyid] NOT NULL,
[EmployeeId] [int] IDENTITY(1,1) NOT NULL,
[FirstName] [varchar](120) NULL,
[MiddleInitial] [varchar](1) NULL,
[LastName] [varchar](120) NULL,
[DepartmentId] [int] NULL,
[Title] [varchar](120) NULL,
[PhoneNumber] [varchar](20) NULL,
[IM] [varchar](120) NULL,
[Photo] [varbinary](max) NULL,
[Bio] [varchar](400) NULL,
[Active] [bit] NULL,
[ManagerId] [int] NULL
)
I want to use an image for the background of a selec/dropdown. The following CSS works fine in Firefox and IE, but does not in Chrome:
#main .drop-down-loc { width:506px; height: 30px; border: none;
background-color: Transparent;
background: url(images/text-field.gif) no-repeat 0 0;
padding:4px; line-height: 21px;}
THANKS
I have a Users Table where it stores city, state and country along with other Users attributes. The states are stored as California, Alabama and so forth. Now I want to retrieve the user information for certain records but the state should get translated to two digit code. Say 'California' should be 'CA'. How should I go about doing this.
I was thinking to create a mapping table for state names with there abbreviation and then use some sort of replace function to do it.
Any ideas ?
I am simply attempting to get jquery to identify the first letter of a paragraph. How would I do this?
For example, I have a page with a number of paragrahs on a page. I would like only the paragraphs starting with a specified letter to be given the class "current" and all others to be hidden. I pretty much know how to add the class and hide the others but, I cant get jquery to recognize the first letter.
Secondly, is it possible to pull this 'first letter' variable from the url string?
For example,
Page 1 - There is a list of letters. The user clicks 'B' and the url is
http://domain.com/page2.html?letter=b
And page2 picks up that variable (b) and applies it to the Jquery, showing only those paragraphs
Our solution is built using Release|x86; however, when our designers try to build using Blend they are forced to use Any CPU which we don't want to to add since it's going to change the behavior. I checked version 4, and it does not seem to address this issue.
Is there a way to specify Solution Configuration/Platform when using Blend? Any workarounds?
I have an arbitrarily deep list of the form:
<ul>
<li></li>
<li>
<ul>
<li></li>
</ul>
</li>
</ul>
I am trying to build a function "nextElement" that returns a jQuery selector.
The first time the function is called, it returns the first li in the list. The second time it is called, it returns the next li in the page. Etc.
I'd like this function to pay no attention to siblings, parents, children, etc. All I care about is that everytime it is called, the next li in the source gets chosen.
Any suggestions on how to go about approaching this?
Thanks