I want to search for numbers, but some of them have - characters or spaces inbetween them, is there a way to do like a
select numbersonly(phone) from table
?
Thanks.
Hi again , My problem still remains, thanks anyway to make it more clear there is my code:
<%=DTask.LU_TECHNICIAN_TITLE% :
0}"
alert('something')
"/
0}"
alert('something')
"
"
selected="selected"
I have two tables invoices and pending_payments both of which have the following rows in common: invoice_id and balance. I want to do a select in MySQL that'll work thus:
[pseudo-code]
if(invoice_id exists in pending_payments table) {
select balance from pending_payments where invoice_id = yadayadayada
} else {
select balance from invoices where invoice_id = yadayadayada
}
Is this even doable in MySQL? If so, how?
Using MySQL, I can do something like
select hobbies from peoples_hobbies where person_id = 5;
and get:
shopping
fishing
coding
but instead I just want 1 row, 1 col:
shopping, fishing, coding
The reason is that I'm selecting multiple values from multiple tables, and after all the joins I've got a lot more rows than I'd like.
I've looked for a function on MySQL Doc and it doesn't look like the CONCAT or CONCAT_WS functions accept result sets, so does anyone here know how to do this?
UI is created in VS 2008. I'm using C# .... I need to let the user move/focus between text fields from top to bottom by clicking tab button. How can i do it?
I have a mysql table with many user input and I want to delete ghost e-mail between a special date. I use this query and it seems to work very good:
DELETE u1 From tx_table u1 JOIN tx_table u2 USING (email) WHERE u1.tstamp < u2.tstamp but I want to delete between a longer time. When I add 300 it seems to delete everything in my table:
DELETE u1 From tx_table u1 JOIN tx_table u2 USING (email) WHERE u1.tstamp < u2.tstamp+300. How can I add 5 minutes to the tstamp with SQL?
I have a model called Company which is acts_as_taggable_on.
When I am /SHOWing a Company (e.g. company/15) I want to be able to see a form that allows me to add tags. I suppose this would be easier by just allowing at edit but sometimes I want to go back and just add tags.
This is what I tried to do and I get an error:
<div id = 'tags'>
<strong>Tags:</strong>
<% form_remote_tag(:url => {:action => 'update'},
:update => 'tags') do %>
<%= text_field :company, :tag_list %>
<%= submit_tag 'Save' %>
<% end %>
</div>
Thanks!
The title is a bit awkward but I couldn't found a better one. My problem is as follows:
I have several users stored as documents and I am storing several key-value-pairs or items (which have an id) for each document. Now, if I apply highlighting I can get the first n items. If you have several hundreds of such items this highlighting is necessary and works nicely. But there are two problems:
The highlighted text won't contain the id and so retrieving additional information of the highlighted item text is ugly. E.g. you need to store the id in the text so that the highlighter returns it. Adding the id to the hl.fl parameter does not help.
You will not get the most relevant n-items. You will get the first n items ...
So how can I find the best items of a documents with multiple such items?
I will now add my own findings as answers, but as I will point out. Each of them has its drawbacks. Hopefully anyone of you can point me to a better solution.
How do i write my spec without using the sleep(1.second) method? When I remove the sleep then my tests break because they are returning the same time stamp?
I have the following class method:
def skip
qs = find_or_create_by(user_id: user_id)
qs.set_updated_at
qs.n_skip += 1
qs.save!
end
and following spec:
qs = skip(user.id)
sleep(1.second)
qs2 = skip(user.id)
qs.should_not be_nil
qs2.should_not be_nil
(qs.updated_at < qs2.updated_at).should be_true
How could I get the selected text in the following code ?
I working with Firefox 3.6.3 (currently not interested in other browsers).
HTML:
<input id="my_text_field" type="text" />
<div id="log"></div>
JavaScript:
$("#my_text_field").select(function() {
var selected_text = "Something selected"; // What should be here ?
$("#log").append(selected_text + "<br />");
});
Ok, I think this is probably an easy question but for the life of my I can't figure it out. I have created a table called ugtags and in that table I have two columns (beyond the basics), 'name' and 'link'.
I am trying to allow a user to add a link to a page. Ideally they would enter the link title (name) and the url (link) and in the view it would display the title as a link to the url that was entered in the link column.
I there a way to do it by simply affecting the <%= link_to h(ugtag.name) %> code?
I use the $_GET function to pull a value with php from the url (http:..../index.html?variable=value), basic stuff. However, I need to use that value in my form.
Typically, I would set
<?php echo 'value="'.$variable.'"' ; ?>
or something to that effect. However, I can't use php inside my form using the editor I'm working with.
Can I set a value in the form without using PHP in my form? If so, how?
I have a view with UINavigationBar on top. The view contains several text fields. Based on a tip to adjust UITextFieldView's position to the top of the view, I did some adjustment. However, my view has a navigation bar on top. How can I take the navigation bar's height into consideration to adjust my text view's position?
data <- read.delim("C:\\test.txt", header = FALSE, sep = "$$$$$")
Error in scan(file, what = "", sep = sep, quote = quote, nlines = 1, quiet = TRUE, :
invalid 'sep' value: must be one byte
Why there is a restriction like this? Can I overcome it?
I have a field aliases of type java.util.Set in one Entity. This Set doesn't denote any relationship to an Entity.
Q1. How can I store this aliases field through JPA?
Q2. How this field get stored in database? I think that for the database, this field is a multi-valued attribute.
Why does
left(FIELD, replace(nullif(charindex('-', FIELD), 0), null, len(FIELD)))
always return null? The idea behind the query is that if charindex() returns 0, then convert the results into null, then convert the null into the length of the field. So if '-' does not exist, show the whole string. For some reason it makes every row equal null.
Thank you.
I have to get the message structure of a protobuf message transfered to me without the message's definition. Using UnknownFieldSet methods, I was able to get a string representation of the message as below:
1: "a"
2: {
3:"b"
4:"c"
}
What data structure does field 2 represent ? Using UnknownFieldSet.Field.getGroupList i was able to get the content of field 3 and 4, does that means field 2 has the "deprecated" group structure ?
I have a table that stores a value that will be added to over time. When I want to add to the value I would like to do so in a single query rather than -
Get oldValue from database
newValue = oldValue + X
update row with newValue
$query1 = "SELECT value FROM table WHERE id = thisID";
$result1 = mysql_query($query1);
while($row=mysql_fetch_array($result)) {
$oldValue = $row['value'];
}
$newValue = $oldValue + x
$query1 = "UPDATE table SET value = $newValue WHERE id = thisID";
Can this be done in a single query?
I made the EditText clickable but you have to "double-click" to bring the dialog box up, which isn't really desired behaviour. How can I bring the dialog box up when the EditText is clicked / gains focus?
Bonus points for including a way to stop the keyboard popping up :)
_createProfileDobEdtTxt.Clickable = true;
_createProfileDobEdtTxt.Click += (sender, e) =>
{
ShowDialog(DATE_OF_BIRTH_DIALOG);
};
here's what the statement looks like:
DELETE FROM videoswatched vw2
WHERE vw2.userID IN ( SELECT vw.userID
FROM videoswatched vw
JOIN users u ON vw.userID=u.userID
WHERE u.companyID = 1000
GROUP BY userID )
that looks decent to me, and the SELECT statement works on its own (producing rows with a single column 'userID'.
basically, i want to delete entries in the 'videoswatched' table where the userID in the videoswatched entry, after joining to the users table, is found to have companyID=1000.
how can i do this without getting the error in my sql syntax? it says the error is near:
vw2 WHERE vw2.userID IN (
SELECT vw.userID FROM videoswatched vw
JOIN users u
and on line 1. thanks!
I have an excel spreadsheet with about 700 entries. The names are listed as "DOE JOHN" (no comma separating the names). I need to format them so they read JOHN DOE.
1.) I would like to learn how to do this in excel.
2.) I would like to learn how to do this in linux.
Thanks!
I have a requirement to have a multiline textbox that accepts any text from any language and stores this into the database for later use.
I am using Linq with ASP .NET 3.5 with a SQL Server 2005 database.
Any/all information you can provide me with is much appreciated :D
Okay I have two tables
VOUCHERT with the following fields
ACTIVATIONCODE
SERIALNUMBER
VOUCHERDATADBID
UNAVAILABLEAT
UNAVAILABLEOPERATORDBID
AVAILABLEAT
AVAILABLEOPERATORDBID
ACTIVATIONCODENEW
EXT1
EXT2
EXT3
DENOMINATION -- I added this column into the table.
and the second table is VOUCHERDATAT with the following fields
VOUCHERDATADBID
BATCHID
VALUE
CURRENCY
VOUCHERGROUP
EXPIRYDATE
AGENT
EXT1
EXT2
EXT3
What I want to do is copy the corresponding VALUE from VOUCHERDATAT and put it into DENOMINATION of VOUCHERT. The linking between the two is VOUCHERDATADBID. How do I go about it?
It is not a 1:1 mapping. What I mean is there may be 1000 SERIALNUMBERS with a same VOUCHERDATADBID. And that VOUCHERDATADBID has only entry in VOUCHERDATAT, hence one value. Therefore, all serial numbers belonging to a certain VOUCHERDATADBID will have the same value.
Will JOINS work? What type of JOIN should I use? Or is UPDATE table the way to go?
Thanks for the help !!
I have an app where users get points for actions they perform - either 1 point for an easy action or 2 for a difficult one.
I wish to display to the user the total number of points he got in my app and the points obtained this week (since Monday at midnight).
I have a table that records all actions, along with their time and number of points.
I have two alternatives and I'm not sure which is better:
Every time the user sees the report perform a query and sum the points the user got
Add two fields to each user that records the number of points obtained so far (total and weekly). The weekly points value will be set to 0 every Monday at midnight.
The first option is easier, but I'm afraid that as I'll get many users and actions queries will take a long time.
The second option bares the risk of inconsistency between the table of actions and the summary values.
I'm very interested in what you think is the best alternative here.
Thanks,
Dorian