When I do \footnote{} for a value in a table, the footnote doesn't show up. How do I get it to show up? Also, is it possible to get it to show up at the bottom of the table rather than the bottom of the page?
Hey guys, I created a list for fixtures.
$result = mysql_query("SELECT date FROM ".TBL_FIXTURES." WHERE compname = '$comp_name' GROUP BY date");
$i = 1;
$d = "Start";
while ($row = mysql_fetch_assoc($result))
{
$odate = $row['date'];
$date=date("F j Y", $row['date']);
echo "<p>Fixture $i - $d to $date</p>";
}
As you can see from the query, the date is displayed from the fixtures table.
The way my system works is that when a fixture is "played", it is removed from this table. Therefore when the entire round of fixtures are complete, there wont be any dates for that round in this table. They will be in another table.
Is there anyway I can run an other query for dates at the same time, and display only dates from the fixtures table if there isnt a date in the results table?
"SELECT * FROM ".TBL_CONF_RESULTS."
WHERE compid = '$_GET[id]' && type2 = '2' ORDER BY date"
That would be the second query!
Hi everyone
Iam trying to this in HQL:
select A.a A.a1, B.b,B.b1 from A,B
where A.x=B.x;
It is simple to realize the join with sql but when returninig in HQL I find a problem.
would you please give me the HQL syntax for the join
Thanks for help.
I wonder if this is possible with straight SQL on MySQL. I need to do SELECT COUNT(*) FROM on each table in the database and output results in one result set.
Is it possible to do with just SQL?
I'm trying to write up a script where the user is able to purchase an amount of points for dollars. I want the transaction to be inserted into MySQL. I keep facing a: "Column count doesn't match value count at row 1" error. And I have no idea what I'm doing wrong.
I have written up this:
mysql_query("INSERT INTO paypal_donations VALUES (NULL, ".$account_id.", ".$char_id.", ".$price.", ".$dp.", NOW(), NOW(), 'Started', 0, 0, '', '');") or die(mysql_error());
But I don't know what to execute in MySQL, since I've never worked with it before.
Could anyone write up a quick script that I can insert into MySQL for it to work.
I have SQL Server 2008. I run a query in a table on a database. The weirdest thing keeps happening. I run a simple select statement on the table. I know there are 62 rows in the table but it gets stuck at row 48 and goes on "querying...". Waited already for hours and it didn't move on from there. I only know of two programs, and one reporting service connecting to that particular table and one other user. Does anyone have any idea on what could be causing this and how I could trace the source of the lock on that table?
As a side note, I noted that the logs only had a notice that Autogrow failed the day before I checked. Could this have something to do with it?
I have two related tables: Groups and Clients. Clients belongs to Groups so I have a foreign key "group_id" that references the group a client belongs to.
I'm changing the Group id from an autoincrement to a UUID. So what I need is to generate a UUID for each Group and update the Clients table at once to reflect the changes and keep the records related.
Is there a way to do this with multiple-table update on MySQL?
Adding tables definitions for clarification.
CREATE TABLE `groups` (
`id` char(36) NOT NULL,
`name` varchar(255) DEFAULT NULL,
`created` datetime DEFAULT NULL,
`modified` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8$$
CREATE TABLE `clients` (
`id` char(36) NOT NULL,
`name` varchar(255) NOT NULL,
`group_id` char(36) DEFAULT NULL,
`active` tinyint(1) DEFAULT '1'
PRIMARY KEY (`id`),
KEY `fkgp` (`group_id`),
CONSTRAINT `fkgp` FOREIGN KEY (`group_id`) REFERENCES `groups` (`id`)
ON DELETE NO ACTION ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8$$
Basically i want to keep the transaction very simple but i should be able to rollback if any error in the later part.
Something like mentioned below,
BEGIN TRANSACTION
DELETE SET 1(this will delete first set of table)
COMMIT
DELETE SET 2 (will delete second set of table)
If any error occurs while deleting set 2 i should be able to rollback set 1 transaction as well.Let me know if we have any options to do like this. Appreciate for your help.
how do i write a query that returns aggregate sales data for California in the past x months.
----------------------- -----------------------
| order | | customer |
|-----------------------| |-----------------------|
| orderId int | | customerId int |
| customerId int | | state varchar |
| deposit decimal | -----------------------
| orderDate date |
-----------------------
-----------------------
| orderItem |
|-----------------------|
| orderId int |
| itemId int |
| qty int |
| lineTotal decimal |
| itemPrice decimal |
-----------------------
I've been looking into JOIN, subqueries and other ways of doing this, but I can't work out the best way to do this is...
I have a table (ps_category_product):
id_product, id_category
I want to perform a query on it like:
SELECT id_product FROM ps_category_product WHERE id_category='$this_cat'
BUT, I only want to perform this query where the ID's are returned by a query on another table (ps_product):
id_product, active
SELECT id_product FROM ps_product WHERE active='1'
Can anyone help me with getting these two queries working together?
I'm quite confused about the basic concepts of a Hash table. If I were to code a hash how would I even begin? What is the difference between a Hash table and just a normal array?
Basically if someone answered this question I think all my questions would be answered:
If I had 100 randomly generated numbers (as keys), how would I implement a hash table and why would that be advantageous over an array?
Psuedo-code or Java would be appreciated as a learning tool...
So I can do Post.delete_all to delete all my posts, but what if I want to delete all posts, comments, blogs, etc. I.e., how do I iterate over all my models and run the delete_all method?
Consider the task of replacing this table with CSS stylings:
<table border="1">
<tr><td align="center">
<img src="foo" />
</td></tr>
<tr><td align="center">
<img src="bar" />
</td></tr>
<tr><td align="center">
<img src="bat" />
</td></tr>
</table>
The desired output is 3 images stacked on top of each other. The images are centered on the widest of them all.
How would you style this markup with <div> around those <img> tags with CSS to achieve the same look?
Hello, I have a table with OWN_ID and OWN_Email -
3ace7cf80edd | [email protected]
3acf6af33ff7 | [email protected]
3acda2524e00 | [email protected]
3ad75583c9a7 | [email protected]
3ad74b018999 | [email protected]
etc.
the problem is that it should contain only a single ID per Email, also I need to replace all OWN_ID values in another table by highest OWN_ID value of the OWN_Email
Table 1 has columns : entry_id user_id ...
Table 2 has columns : entry_id user_id ...
the user_id entry is not always the same so I would like to extract both of them so I can later on compare them in my script
SELECT * FROM
table1 as t1
INNER JOIN table2 as t2 on t1.entry_id=t2.entry_id
WHERE t1.user_id='%s'
I would like to extract t1.user_id and t2.user_id ...the problem is the result array has only user_id
thank you
Hi all,
My situation is next: there are to entities with many-to-many relation, f.e. Products and Categories. Also, categories has hierachial structure, like a tree. There is need to select all products that depends to some concrete category with all its childs (branch). So, I use following sql statement to do that:
SELECT * FROM Products p
WHERE p.ID IN (
SELECT DISTINCT pc.ProductID FROM ProductsCategories pc
INNER JOIN Categories c ON c.ID = pc.CategoryID
WHERE c.TLeft >= 1 AND c.TRight <= 33378
)
But with big set of data this query executes very long and I found some solution to optimize it, look at here:
DECLARE @CatProducts TABLE (
ProductID int NOT NULL
)
INSERT INTO @CatProducts
SELECT DISTINCT pc.ProductID FROM ProductsCategories pc
INNER JOIN Categories c ON c.ID = pc.CategoryID
WHERE c.TLeft >= 1 AND c.TRight <= 33378
SELECT * FROM Products p
INNER JOIN @CatProducts cp ON cp.ProductID = p.ID
This query executes very fast but I don't know how to do that with NHIbernate. Note, that I need use only ICriteria because of dynamic filtering\ordering.
If some one knows a solution for that, it will be fantastic. But I'll pleasure to any suggestions of course.
Thank you ahead,
Kostya
i have a 5 stars rating system, on javascript!!! bau i want to update mysql table, when clicking on stars!!! can somebody tell me how can i update the table!!!
thanks. . .
I have a scenario. Here's my table structure is:
ID LoginDate RemovalDate
----------------------------------------
1 2009/08/01 NULL
2 2009/09/12 2010/01/02
3 2009/08/31 2009/10/29
4 2010/02/17 NULL
5 2009/10/18 2009/11/22
I want a consolidated results of how many ID's were not removed in a particular month. So the result set should be
Date NotRemoved_ID
--------------------------
2009/08 2
2009/09 3
2009/10 3 [One ID got removed in 2009/10]
2010/02 2 [Two got removed in 2009/11 and 2010/01]
Please help.
I am currently trying to display the username of people who i am following, the problem is that during the following process, only the ID of me and the person i'm following is stored.
I've got it to the point where the ID's are displayed but i'd like to show the names hyperlinked. $p_id is the profile ID.
Here's what I've got:
$following = mysql_query("SELECT `follower`, `followed` FROM user_follow WHERE follower=$p_id");
I am following: <?php while($apple = mysql_fetch_array($following)){
echo '<a href="'.$apple['followed'].'">+'.$apple['followed'].'</a> ';
}?>
The usernames are in a different table "users" under the field "username" - I need them to match up with the ID's that are currently displayed, and be displayed.
Any help appreciated,
thanks guys
I have a dropDownList on my form, where i need to have union of values from 2 colums of table [ost].
Type of this columns is currency.
I have russian version of access, default value of curency in "rur" and i need "uah".
I need to change format and save "order by".
I use this query:
(SELECT distinct FORMAT([Sum1] ,'# ##0.00" uah.";-# ##0.00" uah."') FROM ost)
Union
(SELECT distinct FORMAT([Sum2],'# ##0.00" uah.";-# ##0.00" uah."') FROM ost)
ORDER BY 1
The Django documentation gives en example like so:
b = Blog.objects.get(id=1)
b.entry_set.all()
Which from what I understand results in 2 queries. What if I wanted to get the blog, the blog entries and all the comments associated with that entry in a number of queries that does not depend on the number of entries? Or do I have to drop down to SQL to do that?
Sometimes you want to mark a DB table record as deleted instead of deleting it permanently, right?
How do you do that?
So far I've been using a boolean "deleted" field.
It's been asked a million times, its like this.
Say Invoice is the base class and InvoiceHistory is the class that simply inherits from Invoice.
When I do something like
invoiceList = session.CreateCriteria(typeof(Invoice)).List();
I get everything from Invoice (that I want, plus everything from InvoiceHistory).
Do I need to have an InvoiceBase and create derived versions for Invoice and InvoiceHistory?