I am trying to achieve the following:
I have a single ORDER BY statement which could vary depending on the value stored in Column A.
For example:
if the Type is Member, sort by member last name
if the Type is Group, sort by the Group Name
both in Ascending order.
My best guess for the final statement would be:
SELECT *
FROM tabl...
I'm working on a TV guide pagination script - the basic pagination function works properly, no issues there.
This is my current SQL query:
$result = mysql_query("SELECT programme, channel, airdate, expiration,
episode, setreminder FROM mediumonair ORDER by airdate");
However, there's two issues with this script that I'm having troub...
Hi all,
I'm working on displaying a page of classifieds in table rows. The problem I'm trying to solve is to arrange the ads in such a way that reduces the amount of white-space on the page, while maintaining a random order.
A diagram of what a couple of unordered ads look like:
_______________ __________________
ad text here. | an...
I have a table with some stats. Example:
date userId attempts good bad
2010-08-23 1 5 4 1
2010-08-23 2 10 6 4
2010-08-23 3 6 3 3
2010-08-23 4 8 2 6
Each user has to do something, and the outcome is either good or bad. I'd like to find out what the rel...
If I try to do an insert that fails because of a key constraint error, is there a way I can get the name of the key without doing string parsing of the error text?
I already know the error code is 1062; I want to find out which key constraint failed :)
...
I've got a table that helps me keep track of the delay times between my slaves and the master. My question is how can I craft a select statement that:
1. gives me the latest delay values, without repeating (or skipping) ip addresses
2. doesn't need to be updated if I add additional servers, or as servers become unresponsive
The goal of ...
Hi,
I have a table (Counts) with many entries like this:
ID | userid | count | entrydate
where ID is an autoinc PK, userid refers to my Users table, count is a random integer, and entrydate is a unix timestamp.
I also have a table called Listmembers:
listid | userid
where both fields together are PK, and listid refers to some lis...
I have a C# program that I want to dynamically create databases with. Although only privileged users will be using this application, I want to follow best practices security wise. How do I go about doing this? I don't think I can use a parameterized query in this case since I'm not wanting to pass in a string, I want to pass in an ide...
Okay guys - simple question. I have some data in a MySQL database that I want to visualise. Now some methods for doing this are:
Axiis
GetPivot
ManyEyes
Are there any others?
Max.
...
Hi,
I need some help with a mySQL statement.
I've got a mySQL table that looks like this:
Name Year Score Address Zip
Joe 2010 A NULL NULL
Joe 2009 B 123 Main St. 03755
Mary 2010 B NULL NULL
Mary 2009 C 234 Elm St. 03866
I need to grab the 2009 addresses and zips and put them ...
I will try my best to be both succinct and fully explanatory in this predicament.
On a site I manage, we allow a manager to view their "Recruiting Downline" which entails a list of all agents they personally recruited, as well as the recruits that particular agent (and so on and so on) brought to the Team.
For example:
I recruit two...
Hello,
The query below works well. I would like to use it for search results now. I would like to have it return the same results with this one modification:
The field s.title has the variable $find somewhere in it. I. e., the field s.title. doesn't have to exactly equal $find, but it must have a word in it that equals $find.
How c...
In a database we have about 1000 registered users. I'd like to know how many of those users have actually written a question or posted an answer. All the information can be take from the tblQA table and the userid is "intPosterID", the questions & answers each have their own ID, "PostID". Is there a query that can be run to count how man...
IdList = 1,2,3,4,5,6,7,8,9,10
better:
Foreach(id in IdList)
Update MyTable set isDeleted = 1 where id = ?id
or
Update MyTable set isDeleted = 1 where id IN (?IdList)
Forgive my pseudocode, but I think it should be clear.
I know there are limits to the size of the list in an IN clause. It used to be 255 in Oracle.
I'm thinki...
hi,
having major issues with my query processing time :(
i think it is because the query is getting recompiled evrytime. but i dont see any way around it.
the following is the query/snippet of code:
private void readPerformance(String startTime, String endTime,
String performanceTable, String interfaceInput) throws SQLException...
Say I do a self-join like select * from table as t1 LEFT JOIN table as t2 ON t1.id=t2.rank, then fetch results to build an array in php using mysql_fetch_assoc... then print_r the array... Is there a way (not just numbers, but using associative identifiers) to distinguish the columns selected in the join, vs the original?
...
Hi,
When i run select hex(col1) from table1; i get the result as hex number
for ex: the hex(65) is 41, but i wish to get directly thro sql query the result as 0x41 instead of 41, is there a way to get the result as 0x41?
...
I have an enrollment form which takes consumer information, stores it in session, passes from page to page then stores in a database when finished. Originally the table simply listed fields for up to 16 persons but after reading into relational databases, found this was foolish.
I have since created a table named "members" and "manager...
If two tables have foreign keys to the same primary key of another table, does that mean that two indexes are created for those foreign keys or do they use the same index (the primary key index?)
...
Hi all,
I came across the bind address while trying to configure the mysql server. The details of why I want to configure the bind address is in the link below.
http://stackoverflow.com/questions/3540051/multiple-hostnames-and-multiple-privileges
Now, I wan to understand the purpose of the bind address. In the sense, is a bindi...