When I right click on the table, I get the option to Edit TOP 200 rows. I went to option and changed this to TOP 1 row. Now when i open that row, that is not the latest but the last row of my database.
How can I Edit the latest row inserted in my table?
...
Is it possible to limit an AR :include to say only pull in one record...
Item.find(:all,
:include => [ :external_ratings, :photos => LIMIT 1 ])
I have a list of items and each item has between 5 and 15 photos. I want to load a photo id into memory, but i don't need all of them, I just want to preview the first one.
Is there a ...
Hi
I have a mysql database table with a column called task_end_date and task_name.
I want to select all the task_name from the table where the current date has passed task_end_date. How would i do that in mysql using an sql query.
Thanks
...
In my NText column, I have some data in between <script type='text/javascript'> </script> tags.
I want to replace all the data between <script type='text/javascript'> </script> tag with this data below:
<!--//<![CDATA[
var m3_u = (location.protocol=='https:'?'https://d1.openx.org/ajs.php':'http://d1.openx.org/ajs.php');
var m3_r ...
Hi all,
I'm sorry if my question isn't clear.
I have a class contain some properties and one of them is "Parent" which the same type of this class.
when i read data from Database i set the suitable value for each property. But how could i put the "Parent" property when i read it from database as "ParentID".
If it's not clear I'll put...
I am searching for the following string in a nvarchar(max) column
<script src="http://d1.openx.org/ajs.php?zoneid=75288&amp;source
However when I use CharIndex and try to find, I get 0
How can I search for that string? I am using SQL 2008
...
Hi is it possible to convert this sub query to a join ?
SELECT staff_no
FROM doctor
WHERE NOT EXISTS (SELECT *
FROM patient
WHERE staff_no = consultant_no);
...
Can anyone tell me what's the performance gain when using a vertical table for searching? What's faster, a vertical or an horizontal table?
...
Say I have a stored procedure that returns rows:
CREATE PROCEDURE MyProc
AS
BEGIN
SELECT * FROM MyTable
END
Of course my actual procedure is a little more complicated, being why a sproc is necessary.
Is it possible to select the output from calling this procedure?
Something like:
SELECT * FROM (EXEC MyProc) AS TEMP
The reason...
Whats the best way to do this, when looking for distinct rows?
SELECT DISTINCT name, address
FROM table;
I still want to return all fields, ie address1, city etc but not include them in the DISTINCT row check.
...
I have a problem with something I have done many times but this time it just doesn't work.
This is what what I am trying to do (in Visual Studio 2003 and VB.NET)
Earlier in the code:
Private SaveCustomerInformationCommand As System.Data.SqlClient.SqlCommand
Then this in a setup process:
SaveCustomerInformationCommand = New System.D...
In SQL, I'd like to list all funds whose anniversary is due this year in 2 months time. What is the syntax?
...
I've just started working with SQL Server for the first time and I'm having trouble populating test data. I have two tables where one has a foreign key to the other and I would like to be able to insert a new record using the following SQL:
insert into Employee (
EmployeeName,
DepartmentId
) values (
"John Doe",
(select ...
I have three tables: Users, Companies and Websites.
Users and companies have websites, and thus each user record has a foreign key into the Websites table. Also, each company record has a foreign key into the Websites table.
Now I want to include foreign keys in the Websites table back into their respective "parent" records. How do I d...
I'm converting a db from postgres to mysql.
Since i cannot find a tool that does the trick itself, i'm going to convert all postgres sequences to autoincrement ids in mysql with autoincrement value.
So, how can i list all sequences in a Postgres DB (8.1 version) with information about the table in which it's used, the next value etc w...
I'm using the following query to return all records where at least 2 conditions match (provided by Quassnoi).
SELECT *
FROM (
SELECT ContentID
FROM (
SELECT ContentID
FROM VWTenantPropertiesResults
WHERE ContentStreet = 'Holderness Road'
UNION ...
I'm working on what is for me a complicated query, and I've managed to get the information I need, but seem to be forced to create a table to accomplish it. I'm using MySQL, so I can't use WITH, I can't use a view because my SELECT contains a subquery in the FROM clause, and I can't use a temporary table because I need to self-join. Am I...
I've created a view, using the following select statement.
As you can see, i've aliased a lot of the columns to make it far more friendly.
I need to return a column on the end of this that is "GrandTotal" and is basically SubTotal + VAT (this VAT column is displayed as a percentage, so need to add % to this)
Thanks for your help.
SEL...
Hi
i have 2 fields in database and i would like to find the difference of them in percentage.
So mathematical the formula should be
ABSOLUTE((field1-field2)/(MAXIMUM(field1, field2)))
the problem is I dont know how to ask for maximum of 2 numbers. Since MAX in sql returns the max of column.
...
I have moved my drupal site from one mysql server to another one.
Old Machine has 1 cpu, 1GB Ram
New Machine has 4 cpu, 4GB Ram.
I have a huge negative difference in perfomance on this query ( 2 mins vs 2 secs )
select distinct c.client
from client_table c
LEFT JOIN reps r on ( c.client = r.client )
where r.user_id is...