Hii,
I have a query string like "http://project/page1.aspx?userID=5". The operation won't be performed, if the 'userID' parameter changed manually. How it is possible?
I am deriving from TableViewCell. When i query the table view about an index path it returns a UITableViewCell. How do i find if this object is one of my custom type "CustomCell"?
Hi
I want to execute a query using hibernate where the requirment is like
select * from user where regionname=''
that is select all the users from user where region name is some data
How to write this in hibernate
The below code is giving result appropraitely
Criteria crit= HibernateUtil.getSession().createCriteria(User.class);
crit.add(Restrictions.eq("regionName", regionName));
I'm making a parameterized query using C# against a SQL server 2005 instance, and I'd like to take a look at the SQL that is run against the database for debugging purposes. Is there somewhere I can look to see what the output SQL of the parameterized command is, either in the database logs or in the Visual Studio debugger?
Hi everyone,
SELECT * FROM jobs WHERE (SELECT DISTINCT jobs.* FROM jobs, job_requests WHERE (jobs.user_id = 1) OR (job_requests.user_id = 1 AND job_requests.job_id = jobs.id))
This sql gives me Mysql::Error: Operand should contain 1 column(s). If i execute the select from the where clause it works SELECT DISTINCT jobs.* FROM jobs, job_requests WHERE (jobs.user_id = 1) OR (job_requests.user_id = 1 AND job_requests.job_id = jobs.id)
Could somebody explain me why? This query is generated by rails activerecord so the main select is needed.
I have staically added price range with hyperlinks
$0 - $500
$500 - $1,000
$1,000 - $2,500
$2,500 - $5,000
$5,000 - $10,000
$10,000 - $15,000
$15,000 and up
For exa mple when i click the link $1000-$2500 the url is
http://localhost/magento/index.php/catalogsearch/advanced/result/?price[from]=1000&price[to]=2500&category=9
This is working fine.
I want to display the nuber of prodects for each price range only by checking the price field in the table.
What might be the query
Hi,
I'm currently looking to have a mysql query retrieve data and have and a start and limit.
So like, select * from table where x = x START AT ID X LIMIT X
thanks :)
Hello.
This may sound easy, but I've been trying - in vain, apparently - to figure out how I can make a query with MySQL that checks if the value (string $haystack ;) ) in a certain column contains certain data ( $needle ;) ), like this:
mysql_query("
SELECT *
FROM `table`
WHERE `column`.contains('{$needle}')
");
In PHP, the function is called substr($haystack, $needle), so maybe:
WHERE substr(`column`, '{$needle}')=1
Thanks in advance!
Sorry...I mean what question will be for this query?
SELECT SUM(price) FROM Room r, Hotel h
WHERE r.hotelNo = h.hotelNo and hotelName = 'Paris Hilton' and
roomNo NOT IN
(SELECT roomNo FROM Booking b, Hotel h
WHERE (dateFrom <= CURRENT_DATE AND
dateTo >= CURRENT_DATE) AND
b.hotelNo = h.hotelNo AND hotelName = 'Paris Hilton');
What is the most efficient way to convert a MySQL query to CSV in PHP please?
It would be best to avoid temp files as this reduces portability (dir paths and setting file-system permissions required).
The CSV should also include one top line of field names.
Cheers.
On Rails 2.3.8 (but I think Rails 3 might have this issue as well, not sure):
I get an error when trying to execute a LOAD DATA LOCAL INFILE query after reconnecting to a database. I have a process that parses a file that can potentially take a bit of time. During the parsing, Mysql closes the connection due to timeout. This is fine, I do a ActiveRecord::Base.verify_active_connections! and I get the connection back (I do this in several places through my app). However, running a LOAD DATA LOCAL INFILE statement, I get this error:
Mysql::Error: The used command is not allowed with this MySQL version
It's not a permission issue, I know that for sure. Check out my test in console:
ActiveRecord::Base.connection.execute("LOAD DATA LOCAL INFILE '/tmp/test.infile' INTO TABLE users")
[Sat Jan 08 00:09:29 2011] (9990) SQL (1.7ms) LOAD DATA LOCAL INFILE '/tmp/test.infile' INTO TABLE users
=> nil
> ActiveRecord::Base.connection.disconnect!
=> #<Mysql:0x104c6f890>
> ActiveRecord::Base.verify_active_connections!
[Sat Jan 08 00:09:58 2011] (9990) SQL (0.2ms) SET SQL_AUTO_IS_NULL=0
=> {...connection stuff...}
> ActiveRecord::Base.connection.execute("LOAD DATA LOCAL INFILE '/tmp/test.infile' INTO TABLE users")
[Sat Jan 08 00:10:00 2011] (9990) SQL (0.0ms) Mysql::Error: The used command is not allowed with this MySQL version: LOAD DATA LOCAL INFILE '/tmp/test.infile' INTO TABLE users
ActiveRecord::StatementInvalid: Mysql::Error: The used command is not allowed with this MySQL version: LOAD DATA LOCAL INFILE '/tmp/test.infile' INTO TABLE users
from ~/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract_adapter.rb:221:in `log'
from ~/gems/activerecord-2.3.8/lib/active_record/connection_adapters/mysql_adapter.rb:323:in `execute'
from (irb):6
I am able to do other queries like SELECT and whatnot, and I will get the correct result. It's just this one that giving me the error. I even tested this with a fresh rails app. You'll notice that I am able to do the exact same query before the disconnect.
Thanks for the help!
ID NAME AMT
1 Name1 1000
2 Name2 500
3 Name3 3000
4 Name1 5000
5 Name2 2000
6 Name1 3000
consider above table as sample.
am having a problem in my sql query, Am using like this.
Select name,amt from sample where amt between 1000 and 5000
it returns all the values in the table between 1000 and 5000, instead I want to get maximum amount record for each name
i.e.,
3 name3 3000
4 name1 5000
5 name2 2000
Consider tables
Table1
id, name
1 xyz
2 abc
3 pqr
Table2
id title
1 Mg1
2 Mg2
3 SG1
Table3
Tb1_id tb2_id count
1 1 3
1 2 3
1 3 4
2 2 1
3 2 2
3 3 2
I want to do query to give result like
id title
1 MG1
2 MG2
3 Two or More Title
MG1 has higher preference if MG1 and count = 1 then it is given as MG1 title , for others corresponding title is used and for count 1 as two or more
Hi
Based on the following table
Path
----------------------
area1
area1\area2
area1\area2\area3
area1\area2\area3\area4
area1\area2\area5
area1\area2\area6
area1\area7
Input to my stored procedure is areapath and no.of children (indicates the depth that needs to considered from the input areapath)
areapath=area1
children=2
Above should give
Path
-----------
area1
area1\area2
area1\area2\area3
area1\area2\area5
area1\area2\area6
area1\area7
similary for
areapath=area2 and children=1 output should be
Path
---------------
area1\area2
area1\area2\area3
area1\area2\area5
area1\area2\area6
I am confused how to write a query for this one.
I have the following XML LINQ query from my XDocument.
var totals = (from x in MyDocument.Descendants("TOTALS") select x).FirstOrDefault();
Once I have found my totals node I need to add some elements to that node and push that change to the XDocument.
PhotoAlbums table
AlbumID
Title
Date
Photos table:
PhotoID
Title
Date
AlbumID
SELECT AlbumID, Title, Date,
(SELECT TOP (1) PhotoID
FROM Photos AS c
WHERE (AlbumID = a.AlbumID)) AS PhotoID
FROM PhotoAlbums AS a
I need this query written in LINQ-to-SQL. Thanks in advance
http://mycloud.net/js/file.js#foo=bar
I'm trying to load a cross domain javascript file, and want to pass a variable along on the query string. I have seen the above '#' method used, but am unsure of how to extract the 'foo' value from within the file.js. Any clues how to handle this without the aid of server side help?
Thanks.
I want to write an insert query in Grails. I have tried all possible combinations but cant get the syntax correct. Can anybody please help?
class Person {
int age
int name
}
i tried the following:
Person.executeUpdate("insert into Person values (20,30)")
p.s.:Please do not mention using save()
Hi all,
I have an xml fragment as such:
<meta_tree type="root">
<meta_data>
<meta_cat>Content Provider</meta_cat>
<data>Mammoth</data>
</meta_data>
<meta_data>
<meta_cat>Genre</meta_cat>
<data>Games</data>
</meta_data>
<meta_data>
<meta_cat>Channel Name</meta_cat>
<data>Games Trailers</data>
</meta_data>
<meta_data>
<meta_cat>Collection</meta_cat>
<data>Strategy</data>
</meta_data>
<meta_data>
<meta_cat>Custom 1</meta_cat>
<data>PC</data>
</meta_data>
<meta_data>
<meta_cat>DRM Protected</meta_cat>
<data>N</data>
</meta_data>
<meta_data>
<meta_cat>Aspect Ratio</meta_cat>
<data>16:9</data>
</meta_data>
<meta_data>
<meta_cat>Streaming Type</meta_cat>
<data>VOD</data>
</meta_data>
</meta_tree>
which I garnered from the snippet of $meta_tree->asXML().
So given that, I need to have an xpath query for each element, so I'm using:
$meta_tree->xpath("/meta_data[meta_cat='Content Provider']");
but this returns false.
I have tried:
"/meta_tree/meta_data[meta_cat='Content Provider']"
"//meta_data[meta_cat='Content Provider']"
I've been using AquaPath, which validates my query, so I'm not sure what I'm doing wrong.
Anyone got any ideas?
DJS.
Im trying to understand how URL rewriting works. I have the following link...
mysite.com/profile.php?id=23
I want to rewrite the above url with the Users first and last name...
mysite.com/directory/liam-gallagher
From what Ive read however you specify the rule for what the url should be output as, But how do i query my table to get each users name?
Sorry if this is hard to understand, ive confused myself!
Hi All,
Consider this command, as written here:
Command.CommandText = "SELECT COUNT(ASSET) AS POSEXISTS FROM POSITIONS WHERE ASSET = @ASSET";
Command.Parameters.Add("@ASSET",DbType.String).Value = Symbol;
So here, how should I execute this query so that, I can receive the POSEXISTS variable in the C# environment.
Soham
Is it possible to return everything? when $words=""
$result = $cl-Query( $words, 'test1' );
it returns nothing, is there a way for it to return everything?
Hello,
I have pagination links set-up like this:
http://localhost/?page=2
http://localhost/?page=3
They are wrapped in Anchor links as the HREF attribute. I want to know how can I check first if the HREF attribute for a given ANCHOR contains the query string "page" case sensitive, and if it exists return its number the value after page=
Please give me a straightforward example on this, much appreciated. :)
I have two tables:
Table1 = Schools
Columns: id(PK), state(nvchar(100)), schoolname
Table2 = Grades
Columns: id(PK), id_schools(FK), Year, Reading, Writing...
I would like to develop a query to find the schoolname which has the highest grade for Reading.
So far I have the following and need help to fill in the blanks:
SELECT Schools.schoolname, Grades.Reading
FROM Schools, Grades
WHERE Schools.id = (* need id_schools for max(Grades.Reading)*)