I have a table with anniversary dates. I want a query that returns me rows of anniversaries coming up in the next 10 days. For instance:
birthdate
---------
1965-10-10
1982-05-25
SELECT birthdate FROM Anniversaries WHERE mystical_magical_mumbo_jumbo <= 10
+------------+
| birthdate |
+------------+
| 1982-05-25 |
+------------+
1 row in set (0.01 sec)
I'd like to keep the query in the form x <= 10, because I'll use that number 10 in other parts of the query, and if I set it to a variable, I can change it once everywhere by changing the variable, and not have to re-write the query.
According to http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Thread.State.html calling wait() will result a thread to go in BLOCKED state. However this piece of code will result (after being called) in a Thread in WAITING State.
class bThread extends Thread {
public synchronized void run() {
try {
wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
Have I got something wrong? Can anybody explain this behaviour to me?
Any help would be appreciated!
Hello all
I have a table in a MySQL database. I am given a value that occurs as a cell value in that table but I do not know which cell is it i.e. the row and column of that cell. What is the most efficient way to find the column to which that value belongs? Thanks in advance.
if there is no data to display, jsf data table shows headers only. How to say that no records available and also tell me is there any way to get the row index with out having a specific method. thanks in advance
.
.
I came across a case where I have to convert html table data into json. In this process I have to iterate through table and convert one by one(row) into array and then convert the whole array into json? Need help in iterating through table(each ow and column)?
I don't know the best way to title this question but am trying to accomplish the following goal:
When a client logs into their profile, they are presented with a link to download data from an existing database in CSV format. The process works, however, I would like for this data to be 'fresh' each time they click the link so my plan was - once a user has clicked the link and downloaded the CSV file, the database table would 'erase' all of its data and start fresh (be empty) until the next set of data populated it.
My EXISTING CSV creation code:
<?php
$host = 'localhost';
$user = 'username';
$pass = 'password';
$db = 'database';
$table = 'tablename';
$file = 'export';
$link = mysql_connect($host, $user, $pass) or die("Can not connect." . mysql_error());
mysql_select_db($db) or die("Can not connect.");
$result = mysql_query("SHOW COLUMNS FROM ".$table."");
$i = 0;
if (mysql_num_rows($result) > 0) {
while ($row = mysql_fetch_assoc($result)) {
$csv_output .= $row['Field'].", ";
$i++;
}
}
$csv_output .= "\n";
$values = mysql_query("SELECT * FROM ".$table."");
while ($rowr = mysql_fetch_row($values)) {
for ($j=0;$j<$i;$j++) {
$csv_output .= '"'.$rowr[$j].'",';
}
$csv_output .= "\n";
}
$filename = $file."_".date("Y-m-d",time());
header("Content-type: application/vnd.ms-excel");
header("Content-disposition: csv" . date("Y-m-d") . ".csv");
header( "Content-disposition: filename=".$filename.".csv");
print $csv_output;
exit;
?>
any ideas?
I have this query (which I removed some keys from for brevity's sake):
SELECT id as in_id, out_id, recipient, sender, read_flag
FROM received WHERE recipient=1
UNION ALL
SELECT in_id, id AS out_id, recipient, sender, read_flag
FROM sent WHERE sender=1
Which combines the results from two tables showing messages sent and received by a given user. What I'd like to do is add a column/flag to the result to distinguish which table the row belongs to so when I display them I can show a relevant icon for sent or received messages. How would I add this?
I have an asp.net web page that creates a row of textboxes on the click of a button.
I am dynamically creating a TableCell, then a TableRow.
How can I add a space between two tablecells?
hello, I've got one problem...
I created table(with one row and one column) for my site and then I put background for table using CSS where I defined image, after that I try to create in the first table another table with 3 rows, Dreamweaver doesn't allow me to do it, it puts new table after first, how can I solve this problem, thanks in advance...
I'm trying to search multiple fields zc_city and zc_zip for when user input and then return row results for zc_city zc_state and zc_zip
$q = strtolower($_GET["q"]);
if (!$q) return;
$sql = "SELECT DISTINCT zc_city AS zcity FROM search_zipcodes WHERE zc_city LIKE '$q%'";
$rsd = mysql_query($sql);
while($rs = mysql_fetch_array($rsd)) {
$zcity = $rs['zcity'];
echo "$zcity\n";
}
Suppose I want to edit a node in xml and edit one of its attributes. I want to be able to do a simple file diff to just see one row changed. Dumping the xml using prettyprint changes the whole xml structure.
I have a table with the following columns and data
Category Item Price Tax
A I1 1.00 .01
A I2 2.22 .02
B I3 3.33 0.3
I want to group on Category and have the details below such as:
Category/Item Price Tax
A
I1 1.00 .01
I2 2.22 .02
B
I3 3.33 .03
I want the category to have its own row then the detail rows below with the item in the same column as the Category.
The output that is desired is:
Category - Item | Price | Tax
A | |
I1 | 1.00 | .01
I2 | 2.22 | .02
B | |
I3 | 3.33 | .03
Hi,
My issue is that I've got update triggers on an SQL View (MS SQL 2005) which I'm mapping to LINQ to SQL entities in C#...
My SQL looks correct but it complains about trying to insert a null value into a secondary table PK field.
I believe my issue relates to having the primary key and identity as seperate fields in the primary table. So my question is this....when using @@identity, does it look at the primary key of the inserted row, or does it look at the field with "IDENTITY" specified???
I hope the image above can explain what I need. :)
Problem 1: Get the date where it is the first value in the row
Problem 2: Get the date where the value is 100
I would also attach the actual excel file,
but I am limited to posting only 1 link.
for the last cell in a row i want to perform a different action:
this doesn't work:
$('td').each(function(){
var $this = $(this);
if ( $this === $this.parent().last('td') )
{
alert('123');
}
})
and neither does it if i remove .parent()
Hello,
I need help with select statement in MSSQL.
My table looks like this:
Id (int)
QuestionId (int)
GenreId (int)
I want to select random N rows from this table so that maximum number of same GenreId in the result set is less than X for all GenreId-s except one. For that one GenreId, I need row count with that GenreId to be equal to Y.
Thanks in advance
In a set of radio buttons of the same group, only one can be selected at the same time. I would like to have the same behaviour with a normal button.
Imagine there's a row of 3 buttons. When a button is selected it changes: but.setSelected(true) and the other two buttons should be NOT selected: but.setSelected(false)
Now, is there a generic, simple and clean solution to accomplish that in Java (Swing) ?
I have the following query:
select MIN(q.a), * FROM
(
sub-query1
) as q
UNION
sub-query2
How can I return the number of elements in query1 as a row of master-query?
If i use count (*) i´ve only the count
CountElementSub-Query1
i need some like that
rowA, rowB, rowC, CountElementSub-Query1
rowA, rowB, rowC, CountElementSub-Query1
rowA, rowB, rowC, CountElementSub-Query1
rowA, rowB, rowC, CountElementSub-Query1
update: added jsfiddle: http://jsfiddle.net/WgzgF/11/
I have a table with a bunch of <td>. Each td has a div .tdcont which is like a wrapper of all content in that td. In .tdcont, I have 2 groups of divs .alwaystop and .below-at.
<td class="table-td">
<div class="tdcont">
<div class="alwaystop">
<div class="at1">at1</div>
<div class="at2">at2</div>
<div class="at3">at3</div>
</div>
<div class="below-at">
<div class="bat1">bat1</div>
<div class="bat2">bat2</div>
<div class="bat3">bat3</div>
</div>
</div>
</td>
The problem I'm having is that alwaystop is supposed to align itself to the top border of the cell and below-at is supposed to come right under it like this
_____________________________________________________
at1 at2 at3 | at1 at2 at3 | at1 at2 at3 |
bat1 bat2 bat3 | bat1 bat2 bat3 | bat1 bat2 bat3 |
small image here | big image here | |
| is taking lots | |
| of space | |
__________________|_________________|________________|
What I'm finding is that alwaystop and below-at center themselves vertically like you see in this fiddle http://jsfiddle.net/WgzgF/11/ so if one of the adjacent cells in this row is long, alwaystop centers itself to this row's height like this
_____________________________________________________
| at1 at2 at3 | |
| bat1 bat2 bat3 | |
at1 at2 at3 | big image here | at1 at2 at3 |
bat1 bat2 bat3 | is taking lots | bat1 bat2 bat3 |
small image here | of space | |
__________________|_________________|________________|
What I want to do is make alwaystop always start from the top of the cell regardless of adjacent cells' heights, then the below-at comes under it. How can I do this?
I should add that I have the content of alwaystop is floated left, so is the content of below-at, so they're supposed to be like 2 rows inside that td.
.at1, .at2, .at3{
float:left;
}
.bat1, .bat2, .bat3{
float:left;
}
The css for alwaystop and below-at is empty. I tried a whole bunch of stuff like vertical-align and absolute positioning, but nothing worked and I just gave up and deleted them.
.alwaystop{
}
.below-at{
}
Hi,
I'm trying to create a layout with display: table and alike, but it seems that display: table-row and others do not respect width property. Is there a way to over come with this?
I want to make a trigger that will prevent the insertion if the birthdate (one of the columns) is in the future. I have this:
CREATE TRIGGER foo
BEFORE INSERT ON table
FOR EACH ROW
BEGIN
IF NEW.birthdate > CURRENT_DATE()
THEN
???mystery???
END IF;
END;
What goes in the mystery part?