Could somebody tell me what am I doing wrong here?
$query = "SELECT *
FROM routes
WHERE econ <> maxecon
ORDER BY `id`;";
Without the WHERE, it works fine so I know that's the problem.
I want to select data where the column econ is NOT equal to maxecon. Is this even possible at this stage or do I have...
I have three tables to define users:
USER: user_id (int), username (varchar)
USER_METADATA_FIELD: user_metadata_field_id (int), field_name (varchar)
USER_METADATA: user_metadata_field_id (int), user_id (int), field_value (varchar)
I'd like to create a middle tier user that has certain access to other users within the application. To d...
def retCursor():
host = "localhost"
user = "disappearedng"
db = "gupan_crawling3"
conn = MySQLdb.connect( host=host, user=user, passwd=passwd, db=db)
cursor = conn.cursor()
return cursor
singleCur = retCursor()
def checkTemplateBuilt(netlocH):
"""Used by crawler specifically, this check directly whether tem...
I have a table with inventory records and another table with documents describing each inventory records, something like:
inventory (t1)
t1id t1c1
1 desc1
2 desc2
3 desc3
documents (t2)
t2id t2c1 t1id
1 doc1 1
2 doc2 1
3 doc3 2
4 doc4 3
so i try this que...
I have been contracted to store user-contributed photos for a contest run through Facebook. I'm currently having issues uploading files from Facebook to my server (I understand they strip out file variables in post requests, but all the answers I have seen simply say "use an iframe". My app is set up to be an iframe (vs. FBML, in applica...
I'm currently again working on a program from when I was, umm... less capable. It has a number of problems:
The database collation is latin1_swedish_ci. I would like to convert it to utf8. How would I do this?
The database has some fields that are boolean values stored as 0 or 1. However, the fields are varchars instead of bools. How c...
I have a web service with Django Framework.
My friend's project is a WIN32 program and also a MS-sql server.
The Win32 program currently has a login system that talks to a MS-sql for authentication.
However, we would like to INTEGRATE this login system as one.
Please answer the 2 things:
I want scrap the MS-SQL to use only the Djang...
Yesterday I was working on a shell script to perform some moderately complex table insertions to a MySQL database. Naturally I was keeping a mysql client shell window open to for running describe commands, sample queries, and to remove my test rows between test cycles.
Yes this was on a live, production database.
At the point where I ...
Regarding MySql, is there a character set to support all or the vast majority of languages?
...
Making an automated call list to be generated based on certain search criteria that pulls customers names and phone numbers.
There are 4 tables: Customer, Phone_Numbers, Sales_Header, Sales_Detail.
The query is as follows:
SELECT CONCAT(customer.First_Name, ‘’, customer.Last_Name),
Phone_Numbers.Number,
Customer.ID
FR...
Lets say you have a table with some winning numbers in it. Any of these numbers is meant to be only "won" by one person.
How could I prevent 2 simultaneous web requests that submit the same numbers from both checking and seeing that the numbers is still available and then giving the prize to both of them before the number is marked as ...
which is ironic on two counts, 1) because concat(charfield, doublefield) works (it doesn't mind when one of the fields to be concatenated is numeric) and 2) because the mysql reference shows this: CONCAT(str1,str2,...) as the prototype for CONCAT and for FORMAT this: "FORMAT(X,D) Formats the number X to a format like '#,###,###.##', rou...
I have a number of really large files with many insert statements (18.7 million in the largest one). At the mysql> prompt if I do a source file.sql or a ./file.sql everything works good, things get inserted, but there is output for every run statement which ways: Query OK, 1 row affected (0.00 sec).
When run this way these inserts can t...
I think this is more clear than my last version:
I have a table that already has a PK field starting with 1 that is already set for auto-increment. I would like to add a new field that does not start with 1, instead starting with an arbitrary number (think invoice number) and also automatically increments. Apparently, you can only have ...
Any idea why this fails in MySQL 5.1:
SET @LOAD_TIME = UNIX_TIMESTAMP();
SET @OUTFILE = CONCAT(CONCAT('/tmp/outfile_', @LOAD_TIME), '.sql');
SELECT *
FROM `tableA`
INTO OUTFILE @OUTFILE;
Is it a limitation of MySQL's SELECT or am I missing something here?
...
What is the time complexity of a function such as count, sum, avg or any other of the built in "math"-functions in mysql, sql server, oracle and others?
One would think that calling sum(myColumn) would be Linear?
But count(1) isn't, how come and what are the Real time-complexity?
In a perfect world I would want sum, avg and count to b...
Alright, let's say I have these two tables:
items with columns id, stuff
item_properties with columns item_id, prop_id
Now I want to execute a query like
SELECT stuff FROM items WHERE
EXISTS(SELECT * FROM item_properties WHERE prop_id = 123 AND item_id = items.id)
AND EXISTS(SELECT * FROM item_properties WHERE prop_id = 456 ...
So I want our work calendar to automatically sync with each employee's Google Calendar when the scheduling manager posts/updates the schedules. Users would initially opt-in using the AuthSub token, but after that it should be automatic. In order to avoid conflicts with other events they have scheduled, I want to create a new calendar cal...
What is the best way to test MySQL stored procedures? How do you test stored procedures with output parameters in the MySql GUI?
...
Suppose I want to query a table based on multiple WHERE clauses.
Would either of these statements be faster than the other?
SELECT *
FROM table
WHERE (line_type='section_intro' OR line_type='question')
AND (line_order BETWEEN 0 AND 12)
ORDER BY line_order";
...or:
SELECT *
FROM table
WHERE (line_order BE...