cursor.execute("SELECT SQL_CALC_FOUND_ROWS user_id FROM...limit 5")
rows = cursor.fetchall()
...
total_rows = cursor.execute("SELECT FOUND_ROWS()") #this doesn't work for some reason.
Edit: I tried SELECT FOUND_ROWS() FROM my_table...and the numbers are funky.
...
Hey Guys
I am trying to create a car application, each car belongs to a make and model, but only certain makes have certain models.
So I would like a series of select boxes that are populated dynamically based on the previous, however I also would like to add another record to that select box if you cant find the one you want.
I would...
I have a procedure SelectProc wich contains SELECT statement. I want to add a procedure param LimitRowsCount and use it as following:
CREATE PROCEDURE SelectProc (IN LimitRowsCount INTEGER UNSIGNED)
BEGIN
SELECT (...)
LIMIT LimitRowsCount;
END
but this approach doesn't work.
The SELECT itself contains nested subqueries so I ca...
Hi,
I have a photos table where users can have multiple photos.
I'm trying to create the following query:
$q = Doctrine_Query::create()
->update('Photo p')
->set('p.photo_type', 1)
->where('p.user_id = ?', $id)
->andWhere('p.date_added = (SELECT MIN(p.date_added) FROM Photo p WHERE p.user_id = ?)', $id)
The idea is to se...
Is it possible to have a bunch of <select> dropdowns in html that only display a small (say 10 pixels wide) icon, but when you click it the drop down has a list with the icons beside a descriptive string. (Let's see if ASCII art works on SO):
[X]
| X - Disable |
| v/ - Enable |
| O - Ignore |
+-------------+
[O]
[v]
[X]
Can that be...
I have a list of values (Beginner, Intermediate, Advanced, Fluent, Native) that I would like to:
act as the model for a SELECT list
act as a model to convert ids to values in a HTML table
use in multiple controllers and views
keep in an order that preserves the business rules (ordered by skill level)
localize at some point in the futur...
How do you take a value of an option in a select form and use it for a if else statement?
for example if apple is selected as an option then write to the document how to make applesauce but orange is selected then write how to make orange?
so far I have a basic form and select options and I know how to do the document.write but I dont ...
I have the following Access 2002 query I'm running through OLE DB in .NET:
SELECT TOP 25
tblClient.ClientCode,
tblRegion.Region
FROM (tblClient LEFT OUTER JOIN
tblRegion ON tblClient.RegionCode = tblRegion.RegionCode)
ORDER BY tblRegion.Region
There are 431 records within tblClient that have RegionCod...
Hello, hope someone can help. I have two tables:
Users
-UserID
-UserName
UsersType
-UserTypeID
-UserID
Possible values for UsersTypeID is 1 to 6. In that scenario Users may have multiple types and I need to retrieve a distinct row for each user with the columns described below.
UserName - Type1 - Type2 - Type3 - Type4
Joe ...
Hi, I'm trying to perform a DISTINCT clause on a query like this
SELECT DISTINCT username, wiki.text, wiki.date
FROM wiki_house
INNER JOIN wiki ON wiki_house.wiki_id = wiki.id
INNER JOIN users ON wiki.user_id = users.id
AND wiki_house.house_id = 1
AND wiki.language = 'it'
ORDER BY wiki.date DESC
LIMIT 10
this returns:
username wi...
Hello,
I want to pass the Multiple selected values from ListBox as parameters to my Select SQL Query.
I am using VB.NET, how can I achieve this ?...
...
My company had a website we're working on redone by a designer. It looks much better, but I've hit a snag implementing their design in HTML+CSS. They have a heavily styled <select> box, so much so that I couldn't recreate it with pure CSS. I found a solution that uses Javascript to replace the <select> box with a <ul>. This works almost ...
I'm populating select box options via jquery and json but I'm not sure how to address multiple instances of the same chained select boxes within my form.
Because the select boxes are only rendered when needed some records will have ten sets of chained select boxes and others will only need one. How does one generate unique selects to s...
I'm sick of waiting for my developers to fix this, so I decided to ask you guys. I'm trying to modify what they've already given me, so sorry if the setup doesn't make a whole lot of sense. I could probably change it but want to keep as much of the existing table setup as possible.
I've got a MySQL table with a bunch of entries in it, a...
I am making a control panel for administrators on my site that is a search function. When you enter a name it pulls the users first name,last name, email and password. When I tried to insert Birthday into the FULLTEXT to include it in the search, it is not on the drop down. I think because its type is 'date'. Is there a way around that? ...
Hi, I'd like to print a simple table in my page with 3 columns, building name, tags and architecture style. If I try to retrieve the list of building names and arch. styles there is no problem:
SELECT buildings.name, arch_styles.style_name
FROM buildings
INNER JOIN buildings_arch_styles
ON buildings.id = buildings_arch_styles.building_i...
SELECT * FROM `TABLE` WHERE
(`PRIMARY_KEY`= `VALUE1`) OR
(`PRIMARY_KEY`= `VALUE2`) OR
(`PRIMARY_KEY`= `VALUE3`) OR
(`PRIMARY_KEY`= `VALUE4`) OR
(`PRIMARY_KEY`= `VALUE5`) OR ...
This works. But is there a faster way?
...
Hi, I'm trying to query a set of buldings listed on a table, these buildings are linked with tags. I'm able to do it, but my problem is how limit the number of tags to see:
table buildings
id building_name style
1 Pompidou bla
2 Alcatraz bla
3 etc. etc.
table tags // they can be 50 or m...
I need to select data from one table and insert it into another table. Currently the SQL looks something like this:
INSERT INTO A (x, y, z)
SELECT x, y, z
FROM B b
WHERE ...
However, the SELECT is huge, resulting in over 2 millions rows and we think it is taking up too much memory. Informix, the db in this case, runs out o...
I have a query that gets a list of emails who have subscribed for a newsletter trial which lasts 30 days..
$thirty = time() - 3024000;
SELECT c.email
FROM tbl_clients AS c
JOIN tbl_clientoptions AS o ON o.client = c.id
WHERE o.option = 'newsletter'
AND c.datecreated > $thirty
What I want to do is do a check in that same q...