So I have this Query working (where signal_data is a column) in Sybase but it will not work with Microsoft SQL Server:
HEXTOINT(SUBSTRING((INTTOHEX(signal_data)),5,2)) as Signal
I also have it in Excel (where A1 contains the value):
=HEX2DEC(LEFT(DEC2HEX(A1),LEN(DEC2HEX(A1))-2))
Does anyone know how I would do this in SQL?
...
table1 has 3 columns:
Id UserName SubmittedDate
1 Joe 1/1/2006
2 Joe 1/1/2007
3 Nat 1/1/2008
4 Pat 1/1/2009
I want to return this:
Id UserName
2 Joe
3 Nat
4 Pat
I just want just one record for Joe, the most recent one.
How do I write this query? Thanks
...
I would like to extract the SQL queries from Crystal Report .rpt files, is there a way to do this?
I don't have any of the Crystal Reports products, just the .rpt files.
...
I have a table of equipment, a table of customers and a sparse table of equipment and customers. I want to produce a query that returns a 1 if the equipment/Customer table record exists and a 0 if it doesn't for each customer. There are only a small number of customers in this problem, so what I want back should look like this:
Equipme...
I need to write a sql query that adds one column from one database (DB1) to another column and the sum is save in that column in the second database(DB2). where userIds are the same
DB1
TableA
UserId People
DB2
TableB
Amount UserId
it would be something like this
DB2.TableB.Amount = DB2.TableB.Amount + DB1.TableA.People
...
How can I make my clearquest search query case insensitive?
...
Say you have a table layout like the following:
couses:
id (INT),
courseName (VARCHAR)
instructors:
id (INT),
courseId(INT),
instructor(VARCHAR)
Create a query which will print the all the courses and if one instructor is present display their name, if two instructors are present print both of their names on the row in sorted ord...
How can I rewrite the query "select col1 from tbl1" so it splits the results into three columns - each column sorting the results vertically?
So if the data I'm getting back is:
aaa
bbb
ccc
ddd
eee
fff
ggg
I need the query to return it as:
aaa ddd ggg
bbb eee
ccc fff
Is this possible? Thanks
...
Can I write a custom function that I can call when making mySQL queries eg.
My database table has fields 'filetype' and 'filename'. I want to perform a function on filename before returning the result.
$query = "SELECT filetype, MY_FUNCTION(filename) FROM table..";
$result = mysql_query($query);
return $result
SO $result now has the ...
I have a table with roughly 100.000 blog postings, linked to a table with 50 feeds via an 1:n relationship. When I query both tables with a select statement, ordered by a datetime field of the postings table, MySQL always uses filesort, resulting in very slow query times (>1 second). Here's the schema of the postings table (simplified):
...
Hello all,
I am working with polls: Each poll has many options and users can vote in polls once. Thus I have a 'votes' table with the following fields:
id (id of the vote)
option_id (id of the poll option chosen)
user_id (id of the user)
poll_id (id of the poll)
So here is what I'm trying to do: Given an array of poll_ids, I want ...
INFO: I am working with Microsoft SQL.
Ok the title is confusing but here is an example of the table I'm working with:
ID Value Signal Read Firmware Date Time
5 123 656 444 217 3/30/2009 11:00:00 AM
5 123 421 333 217 3/30/2009 04:00:00 PM
5 123 ...
Hi, sorry for this question to be a "can you fix it" one, but this little bit of code has been confusing me for a while now.
I'm basically making a table with a bunch of rows and columns and in each one I have a slightly changing SQl query. To make it a bit easier instead of typing all that out I made this bit of script but it is starti...
What is the optimal query to obtain all the records for one specific day?
In my Weather model, 'timestamp' is a standard DateTimeField.
I'm currently using
start = datetime.datetime(2009, 1, 31)
end = start + datetime.timedelta(hours=23, minutes=59, seconds=59)
Weather.objects.filter(timestamp__range=(start, end))
but wonder if there...
In a MySQL database, I have a table which contains itemID, itemName and some other fields.
Sample records (respectively itemID and itemName):
vaX652bp_X987_foobar, FooBarItem
X34_bar, BarItem
tooX56, TOOX_What
I want to write a query which gives me an output like:
652, FooBarItem
34, BarItem
56, TOOX_What
In other words,...
I have a long-running process in MySQL. It has been running for a week. There is one other connection, to a replication master, but I have halted slave processing so there's effectively nothing else going on.
How can I tell if this process is still working? I knew it would take a long time which is why I put it on its own database in...
I want to know how to take input from users in T-SQL.
For example, how would I do a program which takes two numbers from user and adds them together?
...
I have this little function do connect to a MySQL database:
function connectSugarCRM()
{
$connectorSugarCRM = mysql_connect ("localhost", "123", "123")
or die ("Connection failed");
mysql_select_db("sugar5") or die ("Failed attempt to connect to database");
return $connectorSugarCRM;
}
And then, to run a query, I'm doi...
I have a set of Access d/b's grouped already by year. within a given year, I have a field caleld REPORTDATE which is a standard mm/dd/yyyy field. However, I need to produce queries that return data by the month. For example, I just want to see records for Jan, recs for Feb, Recs for March, etc., so that I can sum them and work wwith thm....
i want to convert a string field to integer using sql query?
...