Hi,
I am using group by ID WITH ROLLUP in my mysql query. The thing is I want to store these totals in a variable in php. Is there any way to do that?
Thanks.
I have a query like this:
SELECT COUNT(*) AS amount
FROM daily_individual_tracking
WHERE sales = 'YES'
AND daily_individual_tracking_date BETWEEN '2010-01-01' AND '2010-03-31'
I am selected from a date range. Is there a way to also get the total days in the date range?
This is my current query - its not getting the required result. I want it do display all of the "resources" even if they dont have a connection.
SELECT *
FROM (`user_permissions`)
JOIN `user_groups` ON `user_groups`.`id` = `user_permissions`.`role`
JOIN `user_resources` ON `user_resources`.`id` = `user_permissions`.`resource`
WHERE `role` = '4'
When I try left join or right join it still returns the same result. The result I get is:
id | role | resource | name
5 | 4 | 2 | Changelog
I want
id | role | resource | name
5 | 4 | 2 | Changelog
null | null | null | Resource2
null | null | null | Resource3
Is this possible?
We had a process that crashed while trying to manipulate an expected mysql record set, running the offending query from the mysql cli showed the following.
mysql SELECT ...;
ERROR 1030: Got error 127 from table handler
Is there a way to easily recreate this condition so we can validate our fix ? (production DB was already repaired).
I need a link for each depotname that will bring up a child window with the details of the last 10 backup status.
while($data=mysql_fetch_array($res))
{
if(is_null($depot_array) || !in_array($data['depotname'],$depot_array ))
{
$depot_array[$r]=$data['depotname'];
if($data['SCP_status'] <> 'success')
{
echo "<tr id='fail'>";
The results of the following query should be displayed in a child window.
select * from backup_log where depotname = $data['depotname']
Hi all,
I have a query factory that takes a column name as an attribute in order to search for that column. Right now I'm passing the name of the column as a string, so it's kind of hardcoded. If the name of the column changes in the entity's annotation, that "hidden dependency" breaks up.
Is there a way in jpa to retrieve the real name of the column and have it available at compile time, so I can use it in queries?
Hello everyone,
I'm trying to pass an SQL query string from a Java Applet to Servlet as a parameter.
Problem is that in Applet I have something say: sql=select * from p where(+p=1)
The resulting sql parameter in the Servlet is sql=select * from p where(+p=1).
So anyone knows how to prevent the browser from removing the + character from parameters?
Is there a escape character?
Thank you.
I have 1000+ access files. Each file has a query named "overview" that has the same fields in each of the 1000 files. I need to import the results of these 1000+ overview queries into one single access db and append them into one table. Is there an automated way to do this? Thanks very much.
Let's say we have a [Valuations] table containing several values per date and per fund:
-FundId
-ValDate
-Value1
-Value2...
The Primary key is obviously FundId+ValDate.
I have also indexed the ValDate field since I often query for values on a specific date.
My question is: should I also create a specific index for the FundId, or is MsAccess clever enough to use the Primary key when querying on a specific FundId ?
When using MySQL 5.1 Enterprise after years of using other database products like Sybase, Infomix, DB2; I run into things that MySQL just doesn't do. For example, it can only generate an EXPLAIN query plan for SELECT queries.
What are the other things I should watch out for?
I was trying to run the following query
UPDATE blog_post SET `thumbnail_present`=0, `thumbnail_size`=0, `thumbnail_data`=''
WHERE `blog_post` NOT IN (
SELECT `blog_post`
FROM blog_post
ORDER BY `blog_post` DESC
LIMIT 10)
But Mysql doesn't allow 'LIMIT' in an 'IN' subquery.
I think I can make a select to count the table rows and then make an ordered update limited by 'COUNT - 10', but I was wondering if there is a better way.
Thanks in advance.
I have a music collection and use sphinx for searching in it. Search mode is SPH_MATCH_PHRASE, but when I search f.e. for "B'Day" album - sphinx cuts "'" and searching by "Day" query. How can I force sphinx to search by exact phrase without filtering any symbols?
I'm trying to figure out how to use Zend_Db_Table_Abstract correctly. I want to return just the name column from my query. Can you please explain what's wrong with the following code?
class Model_DbTable_Foo extends Zend_Db_Table_Abstract
{
protected $_name = 'foo';
public function getFooById($id) {
$select = $this->select(true)->columns('name')->where('id=' . $id);
$row = $this->fetchRow($select);
print_r($row->toArray());
}
}
Hi,
I have a MS SQL query that is selecting a field and it is being chopped off for some reason it is cutting off text at 257 characters.
Is there some kind of default cut-off for retrieving results with MSSQL and PHP?
I'm honestly clueless as to why this is happening. ANY guidance would be greatly appreciated
Currently I have the following query...
SELECT id,
LOWER(title) as title,
LOWER(sub_title) as sub_title
FROM ebay_archive_listing
WHERE MATCH(title, sub_title) AGAINST ("key" IN BOOLEAN MODE)
However it is not finding rows where the title contains the word "key". "key" is generated dynamically based on a set of keywords, so sometimes it contains + and - symbols.
When I try to create a jquery alert coming from an ajaxy query, I don't get any response. Do you know how to fix it ?
jquery:
$.ajax({
type: "GET",
url: "php/submission.php",
success:function(data){
if(data==1)
{
alert("working");
}
}
});
submission.php:
echo '1';
I am trying to convert rows into columns. here is my query
SELECT M.urn,
M.eventdate,
M.eventlocation,
M.eventroom,
M.eventbed,
N.time
FROM admpatevents M
INNER JOIN admpattransferindex N
ON M.urn = N.urn
AND M.eventseqno = N.eventseqno
AND M.eventdate = N.eventdate
WHERE M.urn = 'F1002754364'
AND M.eventcode = 'TFRADMIN'
Current result
URN Date Location Room Bed Time
F1002754364 20121101 EDEXPRESS 4-152 02 0724
F1002754364 20121101 CARDSURG 3-110 02 1455
F1002754364 20121102 CHEST UNIT 6-129-GL04 1757
required result
F1002754364 20121101 EDEXPRESS 4-152 02 0724 20121101 CARDSURG 3-110 02 1455 20121102 CHEST UNIT 6-129-GL 04 1757
Thanks for your help.
I want to get file size I'm doing this:
my $filename=$query->param("upload_file");
my $filesize = (-s $filename) ;
print "Size: $filesize ";
Yet it is not working.Note that I did not upload the file. I want to check its size before uploading it. so to limit it to max of 1 MB.
Is there a way to keep the order when using SELECT WHERE IN()? For example, using the following query:
SELECT id FROM data_table WHERE id IN(56,55,54,1,7);
The results will come back using the default order by id. 1,7,54,55,56
When I want to keep the order used in the IN: 56,55,54,1,7
Is there a quick way to do this in mySQL or will I be forced to order it after in code.
Thanks :)
I have this query in sql server 2000:
select pwdencrypt('AAAA')
which outputs an encrypted string of 'AAAA':
0x0100CF465B7B12625EF019E157120D58DD46569AC7BF4118455D12625EF019E157120D58DD46569AC7BF4118455D
How can I convert (decrypt) the output from its origin (which is 'AAAA')?
Hi,
I need to pass a variable to model, that model needs to send another back and use that variable to query a different model.
EG:
I have a product_ID which I send to the product model, From that I find out the supplier_ID. I want to grab that supplier_ID to the supplier model to get the supplier name.
How do you implement this in codeigniter?
I need to create simple pagination of objects, but when I read manual I found out that query.setRange(5, 10); will fetch 10 objects, even when only 5 objects are needed.
Is there anyway to fetch just needed objects?
EDIT: I started bounty, so fi you can show me simple example code in Java that works, then I will accept you answer.
id Ptypefield Value
1 1 D
2 1 E
3 1 F
4 1 G
5 1 H
6 2 FL
7 2 IF
8 2 VVS1
9 2 VVS2
10 2 VS1
11 2 VS2
12 3 0.50
13 3 1.00
14 3 1.50
15 3 2.00
16 4 Marquise
17 4 Round
18 4 Pear
19 4 Radiant
20 4 Princess
this table i want to get id no i give value like D and F
my ans is 1 and 3
please write a query
Hey all
i am working at my project where it collects information from two database, one is supplied by the program lets name it DB Y and the other supplied by the user lets name it DB X , now i have an query that depends on companies which is on DB x so i want to transfer this table from DB x to DB y at run time and also checks if there is new updates in DB x and transfer them but i am confused
I have a first name and a surname as separate columns in a table. If I bind a combo box to a query and set DisplayMember property to "Name" then each person a table is represented in a combo box by its name. How do I show each person's full name (built from concatenating 2 columns) in a single comb box item in this case?