Hi, I have a problem with parameters replacing by Spring JdbcTemplate.
I have this query :
<bean id="fixQuery" class="java.lang.String">
<constructor-arg type="java.lang.String"
value="select fa.id, fi.? from fix_ambulation fa
left join fix_i18n fi
on fa.translation_id = fi.id order by name...
The following query returns one row as expected when run from phpmyadmin.
SELECT units . * , locations . *
FROM units, locations
WHERE units.id = '1'
AND units.location_id = locations.id
LIMIT 0 , 30
But when I try to do it in Kohana 3:
$unit = DB::select('units.*', 'locations.*')
->from('units', 'locations')
->where('units.id', '...
Is there any way to use custom sql with NHibernate? I want to use a complex sql for a specific column.
Example:
select id, viewsCount, commentsCount,
0.2 * viewsCount / (select top 1 viewsCount from articles where isActive = 1 order by viewsCount DESC) as priorityViews,
0.8 * commentsCount / (select top 1 commentsCount from artic...
Should I invest a lot of time trying to figure out an ORM style implementation, or is it still common to just stick with standard SQL queries in python/pylons/sqlalchemy?
...
I am trying to update a record in the target table based on the record coming in from source. For instance, if the incoming record is present in the target table I would update them in the target else I would simply insert. I have over one million records in my source while my target has 46 million records. The target table is partitione...
One table in my MySQL database tracks game plays. It has the following structure:
SCENARIO_VICTORIES
[ID] [scenario_id] [game] [timestamp] [user_id] [winning_side] [play_date]
ID is the autoincremented primary key. timestamp records the moment of submission for the record. winning_side has one of three possible values: 1, 2, or ...
Hi,
i have two tables category and hotels where category.id should be equal to hotels.catid. Now how do i select 3 rows from each different category from the hotels table.
I have this query:
select h.* from hotels h inner join category c on h.catid = c.id
order by h.catid, h.hid
this selects all records, but i want to select three r...
I am try to find the top n number of categories as they relate to articles, there is a habtm relationship set up between the two. This is the SQL I want to execute, but am unsure of how to do this with ActiveRecord, aside from using the find_by_sql method. is there any way of doing this with ActiveRecord methods:
SELECT "categories".id,...
I am going to be crazy I think. Please Help.
I have a table which fields are Date, No, Turnover, TotalWin, Opencredit, Handpay, Billin, gamesplayed and I am trying to write sql in vb.net that will show me previous day value but I cant. Here is what I am trying to do.
SELECT Meter.*
FROM
Meter AS Previous,
Turnover As Prev_turnov...
Anyone have an idea about how to use sp_helptext to view a stored procedure on a linked server? basically something like this. I don't have the credentials to that linked server to look at it.
EXEC sp_HelpText '[ServerName].[DatabaseName].dbo.storedProcName'
thanks ahead.
...
I'm getting a very strange behavior in MySQL, which looks like some kind of weird bug. I know it's common to blame the tried and tested tool for one's mistakes, but I've been going around this for a while.
I have 2 tables, I, with 2797 records, and C, with 1429. C references I.
I want to delete all records in I that are not used by C, s...
I want be able to find tags of items under the a certain category. Following is example of my database design:
images
+----------+-----+-------------+-----+
| image_id | ... | category_id | ... |
+----------+-----+-------------+-----+
| 1 | ... | 11 | ... |
+----------+-----+----------...
Hi,
I have 2 tables: comments and posts and I'd like to display a list of 15 posts and maximum 2 most recent comments under each blog post
the database scheme looks like this
posts_table: post_id, post_txt, post_timestamp
comments_table: post_id, comment_txt, comment_timestamp
how the mysql query should look like to select 15 posts ...
' Setting variables
Dim con, sql_insert, data_source
data_source = "project_db"
sql_insert = "insert into cart ( UserID,Count,ProductName,ProductDescription,ProductPrice) values ('"&user_id&"','"&count&"','"&product_name&"','"&product_description&"','"&product_price&"')"
' Creating the Connection Object and opening the database
Se...
Hi all,
I have recently started to use Kohana and I know inheritance is in infancy stages at the moment. The work around is using a $_has_one annotation on the child class model. In may case i have "page" as the parent of "article". I have something like,
protected $_has_one = array('mypage'=>array('model'=>'page', 'foreign_key'=>'id'))...
Hi,
I'm just starting out with NHibernate and I'm having trouble with running more complex queries.
I have entities with a list of tags attached. The user will provide two lists of tags, include and exclude.
I need to find all the entities that have all of the include tags, and exclude any entites that have any tag in the exclude lis...
I am trying to lower the amount of queries that my django app is using, but I am a little confused on how to do it.
I would like to get a query set with one hit to the database and then filter items from that set. I have tried a couple of things, but I always get queries for each set.
let's say I want to get all names from my DB, b...
I am testing the performance of a data streaming system that supports continuous queries.
This is how it works:
- There is a polling service which sends data to my system.
- As data passes into the system, each query evaluates based on a window of the stream at the current time.
- The window slides as data passes in.
My problem is t...
We have an Oracle 10g database (a huge one) in our company, and I provide employees with data upon their requests. My problem is, I save almost every SQL query I wrote, and now my list has grown too long. I want to organize and rename these .sql files so that I can find the one I want easily. At the moment, I'm using some folders named a...
I am getting the following error. Could you please help me in ?
Msg 547, Level 16, State 0, Line 1
The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Sup_Item_Sup_Item_Cat". The conflict occurred in database "dev_bo", table "dbo.Sup_Item_Cat".
The statement has been terminated.
insert into sup_item (supplier_id,sup_it...