select-query

How can I select from list of values in SQL Server

I have very simple problem that I can't solve. I need to do something like this: select distinct * from (1, 1, 1, 2, 5, 1, 6). Anybody can help?? ...

SQL Server PRINT SELECT (Print a select query result)?

I am trying to print a selected value, is this possible? Example: PRINT SELECT SUM(Amount) FROM Expense ...

MySQL floating point comparison issues

I ran into an issue by introducing floating point columns in the MySQL database schema that the comparisons on floating point values don't return the correct results always. 1 - 50.12 2 - 34.57 3 - 12.75 4 - ...(rest all less than 12.00) SELECT COUNT(*) FROM `users` WHERE `points` > "12.75" This returns me "3". I have read that the ...

nhibernate intercept select query

Hey, I'm looking at the nhibernate interceptor. It seems to be able to intercept save, update and delete queries but is there anyway I can intercept a select query. The problem I have is that I automatically want to append some additional sql filters to the executing sql statement in certain cases. Any thoughts Thanks Mat ...

MySQL syntax error in SELECT query

My code: $fileid = $_GET['imgid']; $fileid = (int)$fileid; //id is int type in photos table require 'database.php'; //get the image sourc name $q = "SELECT src form photos WHERE id='$fileid'"; $result = $mysqli->query($q) or die(mysqli_error($mysqli)); if ($result) { $row = $result->fetch_object(); $filename = $row->src; ...