Here is a table
CarID| Attribute | Value
1 | Color | Red
2 | Color | Blue
3 | Color | Red
1 | Type | Coupe
2 | Type | Hatch Back
3 | Type | Coupe
3 | Make | Honda
2 | Make | Toyota
1 | Make | Ford
Now I would like to run a filter Like Select * From Cars WHERE (Attribut...
Hi All
I am trying to import a large blob field from a MySQL table via SAS ODBC passthrough. The field is larger than the maximum length allowed in SAS. According to SAS 9.2 documentation character type fields can have a maximum length of 32k. Has anyone had experience storing large character fields in SAS? Any suggestions other than...
Just trying to make sure all my queries are sanitized. We're using ADOdb (it's already in place, so no talking me out of it).
Is there something in ADOdb like mysql_real_escape_string?
...
The goal of this query is to get a total of unique records (most recent per IP, by IP) per ref ID.
SELECT COUNT(DISTINCT ip), GROUP_CONCAT(ref.id)
FROM `sess` sess
JOIN `ref` USING(row_id)
WHERE sess.time BETWEEN '2010-04-21 00:00:00' AND '2010-04-21 23:59:59'
GROUP BY ref.id
ORDER BY sess.time DESC
The query works fine, but its using...
I have a legacy rails (version 1.2.3) app which runs without issue on a number of servers (not to mention my local environment). Deployed to its newest server, though, and I now get ActiveRecord::StatementInvalid: Mysql::Error: #23000Column 'video_id' cannot be null errors.
Below are the models/relationships, simplified:
class Video < ...
Hey guys I have a query that currently finds the latest comment for each of a user's topics and then orders topics by that comment's timestamp. What I want to do is expand on this query's use and print the latest comment for each topic. The problem with this query is that while it orders the topics correctly, it prints seemingly random c...
since a primary key (identifier) wont be under 0, i guess it should always be unsigned?
...
I have two tables in a MySQL Database.
Users table and Users Meta Table
I am looking for a way to get all the information out of both tables with one query. But without repeating the information from Users table.
This is all information relating to the users id number as well. So for example user_id = 1.
Is there a way to query the d...
I'm using the extra() modifier in a view.
(See http://docs.djangoproject.com/en/1.1/ref/models/querysets/#extra-select-none-where-none-params-none-tables-none-order-by-none-select-params-none )
Here's the the code:
def viewname(request)
...
exact_matchstrings=[]
exact_matchstrings.append("(accountprofile.first_name LIKE '"...
Is it possible to use a column value from an outer select within a joined subquery?
SELECT table1.id, table2.cnt FROM table1 LEFT JOIN (SELECT COUNT(*) as `cnt` FROM table2 where table2.lt > table1.lt and table2.rt < table1.rt) as table2 ON 1;
This results in "Unknown column 'table1.lt' in 'where clause'".
Here is the db dump.
CRE...
java.sql.SQLException: Incorrect string value: '\xAC\xED\x00\x05sr...' for column 'xxxx'
The column is a longtext in MYSQL with utf8 charset and utf8_general_ci collation.
What is wrong?
...
Hello.
How would I get last 12 digits of a string using mysql?
Let's say I have a varchar field with a tracking number, that may be anywhere from 5 to 20 varchars long. But I only need to select last 12 digits or less if there are less.
so in a field = 12345678123456789012
I would only need to get what's in brackets
field = 1234567...
Hi! I'm using MySQL with PHP. This is like my table: (I'm using 3 values, but there are more)
id | 1 | 2 | 3
---+---+---+----
1 | 3 |12 |-29
2 | 5 |8 |8
3 | 99|7 |NULL
I need to get the greatest value's column name in a certain row. It should get:
id | maxcol
---+-------
1 | 2
2 | 2
3 | 1
Are there any queries that wi...
I'm new to relational databases and all the material I've read covered primary and foreign keys, normal forms, and joins but left out to populate the database once it's created.
How do you import a CSV file so the fields match their related table?
Say you were tying to build a beer database and had a CSV file with each line as a recor...
Hey guys,
New to rails, trying to figure out something simple. Seems as though I cannot migrate a very simple mysql database using "rake db:migrate" command.
Here is the issue: I know rails defaults to sqllite right now, but I need to use mysql for a series of reasons.
Use the following commands
rails -d mysql MyMoviesSQL
cd MyMovies...
users table:
id-user-other columns
scores table:
id-user_id-score-other columns
They're are more than one rows for each user, but there's only two scores you can have. (0 or 1, == win or loss). So I want to output all the users ordered by the number of wins, and all the users ordered by the numbers of losses.
I know how to do this...
I have a perplexing issue that I can't seem to comprehend... I'm hoping someone here might be able to point me in the right direction...
I have two SQL statements:
- the first enters information from a form into the database.
- the second takes data from the database entered above, sends an email and then logs the details of the transac...
I'm having some a little trouble understanding how to handle the database end of a program I'm making. I'm using an ORM in Kohana, but am hoping that a generalized understanding of how to solve this issue will lead me to an answer with the ORM.
I'm writing a program for users to manage their stock research information. My tables are...
I have a C# List, that is filled from a database.. So far its only 1400 records, but I expect it to grow a LOT.. Routinely I do a check for new data on the entire list.. What I'm trying to figure out is this, is it faster to simply clear the List and reload all the data from the table, or would checking each record be faster..
Intuit...
Hi all, I am having trouble putting the final touches on my MySQL/Apache/phpMyAdmin install on a Windows XP system. I am trying to get rid of all the error message in phpMyAdmin and I have gotten rid of all of them except the ones related to "advanced features." The exact error message I have is :
The additional features for working w...