query

I can't understand GroupJoin where i will need it in database relationships.

Hello Everybody I am thinking 5-6 hours to understand something about GroupJoin. I am talking about query with linq for Database tables.I understand what Join and GroupJoin does but I really couldn't understand where i will need it.I feel that Join does all what i will need but if there is something which Join can't without GroupJoin so...

Appengine datastore phantom entity - inconsistent state?

Getting a weird error on java appengine code that used to work fine (nothing has changed but the data in the datastore). I'm trying to iterate over the results of a query and change a few properties of the entities. The query does return a set of results, however, when I try to access the first result in the list, it throws an exceptio...

Help me alter this query to get the desired results - Resolved

Please dump these data first CREATE TABLE IF NOT EXISTS `all_tag_relations` ( `id_tag_rel` int(10) NOT NULL AUTO_INCREMENT, `id_tag` int(10) unsigned NOT NULL DEFAULT '0', `id_tutor` int(10) DEFAULT NULL, `id_wc` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`id_tag_rel`), KEY `All_Tag_Relations_FKIndex1` (`id_tag`), KEY `id...

Rendering spatial data of GeoQuerySet in a custom view on GeoDjango

Hello. I have just started my first project on GeoDjango. As a matter of fact, with GeoDjango powered Admin application we all have a great possibility to view/edit spatial data, associated with the current object. The problem is that after the objects having been populated I need to render several objects' associated geometry at once...

NHibernate Projection Components

Hello guys im trying to hydrate a DTO using projections in NHibernate this is my code IList<PatientListViewModel> list = y.CreateCriteria<Patient>() .SetProjection(Projections.ProjectionList() ...

Mysql Limit column value repetition N times

Hi at all, is my first question here, so be patient ^^ I'll go directly to problem, I have two table Customer (idCustomer, ecc.. ecc..) Comment (idCustomer, idComment, ecc.. ecc..) obviosly the two table are joined togheter, for example SELECT * FROM Comment AS co JOIN Customer AS cu ON cu.idCustomer = co.idCustomer With this I se...

oracle query returns 4 duplicates of each row

I am running an Oracle query. It seems to work except that it returns 4 duplicates of each result. Here is the query: Select * from ( Select a.*, rownum rnum From ( SELECT NEW_USER.*, NEW_EHS_QUIZ_COMPLETE.datetime FROM NEW_USER, NEW_EHS_QUIZ_COMPLETE WHERE EXISTS ( select * from NEW_E...

SharePoint 2010 custom search from Layouts page

Hi, I am querying SharePoint 2010 search using FullTextSqlQuery. The query returns results as long as i run it from the webpart. However, for some reason, i need to run the same query from a custom aspx page deployed under layouts. The query returns a wcf exception. Has anyone tried running custom queries from pages deployed to layouts...

SQL 2008 Change Data Capture Query Performance Issue (SP vs. straight query)

Before I open a ticket with Microsoft Support, I thought I'd try the community! I have an application in development for which we are using Change Data Capture in SQL 2008 R2 (developer edition, currently). For some particularly complex queries, we wanted to wrap the queries into stored procedures, exposing common parameters, to avoid c...

retrieving second most highest value from the table

how do i retrieve the second highest value from the table ...

Get a DB result with a value between two column values

Hi, I have a database situation where I'd like to get a user profile row by a user age range. this is my db: table_users username age email url pippo 15 [email protected] http://example.com pluto 33 [email protected] http://example.com mikey 78 example@exam...

SQL Server Querying An XML Field

I have a table that contains some meta data in an XML field. For example <Meta> <From>[email protected]</From> <To> <Address>[email protected]</Address> <Address>[email protected]</Address> </To> <Subject>ESubject Goes Here</Subject> </Meta> I want to then be able to query this field to return the following results F...

Using a RegEx in a SQL Query

Hey Everyone, Here's the situation I'm in: We have a field in our database that contains a 3 digit number, surrounded by some text. This number is actually a PK in another table, and I need to extract this out so I can implement a proper FK relationship. Here's an example of what would currently reside in the column: Some Text Goes ...

sql Query in MS Access

Trying to get this query to work in MS Access. Update Network.Location=Enclave.Location Where Enclave.Site=No AND Network.AlternateLocation=Enclave.Location Where Enclave.Site=Yes I'm not sure how to get this to do exactly what I want which is store Enclave location in network location if the enclave site field is No and if yes sto...

When optimizing database queries, what exactly is the relationship between number of queries and size of queries?

To optimize application speed, everyone always advises to minimize the number of queries an application makes to the database, consolidating them into fewer queries that retrieve more wherever possible. However, this also always comes with the caution that data transferred is still data transferred, and just because you are making fewer...

Dates that intersect

Hi everyone, I've been researching this problem for awhile now and I can't seem to come to a solution, hopefully someone here can help. Currently I'm working with Microsoft SQL server management, I've been trying to do the following: Previously, the old query would just return the results that fit between two dates Heres the previous ...

help with delete where not in query

I have a lookup table (##lookup). I know it's bad design because I'm duplicating data, but it speeds up my queries tremendously. I have a query that populates this table insert into ##lookup select distinct col1,col2,... from table1...join...etc... I would like to simulate this behavior: delete from ##lookup insert into ##lookup sele...

What is the fastest findByName query with hibernate?

I am sure I can improve the performance of the following findByName query of hibernate: public List<User> findByName(String name) { session.createCriteria(User.class).add(Restrictions.eq("name", name)).list(); } The bottleneck is that findByName method and I cannot use the id instead. In my case I know that the name is unique but a...

How do I add a variable to column2 when column1 is a specific value

How can I do a search for value A in column1 and add a value B in column2? In other words for every record that column1 has the value A I want to make the value in column2 = B (Currently column2 is empty) Would this work? UPDATE MyTable SET Column2 = REPLACE(Column2,NULL,'B') WHERE Column1 = "A" ...

SQL query not taking values more than 2100

SELECT MachineID, MachineName, count(ID) as Total, sum(Size) as TotalSize FROM Files join Machines on Files.MachineID = Machines.MachineID Where Files.MachineID In(sql.Append(string.Format("@MachineId{0}", i)); group by Files.MachineID,MachineName now when the machinId count is less than 2100 the query is performed and if it m...