query

Insert auto-number from newly inserted row in Access with Coldfusion

I have a few tables: a medError table, an option table, and a selected_options table. When somebody submits the relevant form, I have an insert which inserts all the info from the form to the medError table. However, on this form, there is a section of dynamic checkboxes based on the items in the option table. The selected_options table...

PHP query output of SQP

I have no actual php errors, but When I make my query this I get output : $sql_result = "SELECT AuthorFirst, AuthorLast, OnHand, Title FROM Inventory i, Wrote w, Author a, Book b WHERE i.BookCode = b.BookCode AND i.BookCode = w.BookCode AND a.AuthorNum = w.AuthorNum AND 2 = i.BranchNum"; When ...

Can anyone tell why this Hibernate query is invalid?

I have criteria query that, when executed, results the following exception thrown: java.lang.IllegalArgumentException: org.hibernate.QueryException: illegal syntax near collection: id [select generatedAlias0.permissions from temp.package.commons.user.Role as generatedAlias0 where generatedAlias0.id=2L] at org.hibernate.ejb.AbstractEntit...

SQL Query to show number of stories created in last 24 hours?

I'm trying to create a custom query that will show the number of stories that have been posted in the last 24 hours on a Drupal 6 site. Stories are stored in the "node" table. each record has a "created" row that records the UNIX timestamp when the story was posted. Here's the query I'm trying so far: $sq = 'SELECT COUNT(*) cnt ' ...

Converting a MySQL query, to a routine which takes parameter

Hi! I'm using VSC++ and MySQL ver.5.2.25 database, I've tested a query In MySQL that is like this: select Name from test.virus where Name LIKE 'b' '%' ORDER BY Name; It works well and return all Names that starts with 'b',I want to use a routine instead of this query, so that I can call the routine from my program. I've tried this...

Unsure how to join tables 3 times to get the desired result

I am trying to put together a query that gives me a report of number of sales of products and their stock level in 3 seperate locations (store branches) The idea is to group together the results as follows: Prod. | Loc1 Sales | Loc1 Stk | Loc2 Sales | Loc2 Stk | Loc3 Sales | Loc3 Stk Item 1 | 323 | 34 | 23 ...

How to add to table additional column with belonging value

Hi, The table aggregate_monthly_conversations consists of columns user_A, user_B, user_B_location and the table monthly_statistics consists only of user_A AND user_B I would like to add the column user_B_location to table monthly_statistics and fill it with appropriate values. To get appropriate values user_B_location for user_B in ta...

putting records in new table that don't have 6 or more different addresses for same name - Microsoft Access

Hey all, If the names repeated is more than 6 and there are six different addresses for that same name, then I don't want to output them to the KeepThese table: harry baker 1 street harry baker 2 street harry baker 3 street harry baker 4 street harry baker 5 street harry baker 6 street donald ross 11th street So harry baker should be...

Performing caldav-queries using the CalDAVClientLibrary

I am trying to query the Apple Calendarserver via the Python CalDAVClientLibrary. I can connect to the server, list the available calendars and read out the whole calendar, also I am able to store a new event.For these operations, caldav uses the HTTP-Methods GET, PUT, REPORT and PROPFIND. As an example (assuming there is at least one c...

Help understanding weird Bing phrase query behavior

I've noticed in searching Bing that I sometimes don't get the results I'm expecting. For example, the search "Singapore Bao" "29 Bendeemer Road" "330029" returns 10 results, 2 pages that contains all of the above phrase Looks like Bing does some phrase manipulation. If I only want to see those two results the advanced search page indi...

Using an if statment into a cursor declaration.

Hi. Im using a cursor to go over some data but I need to declare diferents sql statments according to a parameter. The problem seems to be that Im no able to use if statmets into this declaratios: DECLARE CURSOR c IS SELECT * FROM TRAFICO IF TipoConsulta = 'mes' then BEGIN WHERE TO_CHAR(FECHA...

LDAP Query URL - how to refer an attribute?

Hi, I have set up some database connection parameters on an OpenDS ldap server, using my own schema. It looks as the attached screenshot. when I try to query the LDAP using following URL, it fails. ldap://localhost/db-configname=local1,ou=eways,dc=repository,dc=com?db-serverName?sub I have LDAPAdmin that automatically opens LDAP URLs...

Help writing a fast complex query

Hi, I'm trying to write a query to get a courses information and the number of bookings and attendees. Each course can have many bookings and each booking can have many attendees. We already have a working report, but it uses multiple queries to get the required information. One to get the courses, one to get the bookings, and one to g...

Can anyone tell why this JPA criteria query generates an invalid SQL statement when executed (Hibernate) and how to fix it?

Hi! I'm having a hard time constructing a criteria query to get the "permissions" attribute from the Role entity with id = 2. The permission attribute is of Set type, so I'm creating a join and selecting from it, but the query fails with invalid grammar exception reporting "Unknown column '2L' in 'where clause'" The criteria query that...

MySQL: List instructors (names) who taught a section of CS160 and a section of CS340 in 99F term.

The schema is as follows: Student(Snum, Sname) Course(Cnum, Cname) Professor(Pnum,Pname, Dept, Office) Class(Cnum, Term, Section, Instructor) How can I join the two selects below to get Instructors who taught both CS160 and CS340? SELECT DISTINCT Instructor FROM class WHERE Term = "99F" AND Cnum = "CS160" SELECT DISTINCT Instructor F...

How do I query an object collection using user defined conditions?

Sorry if this is a little abstract. I'm in the early stages of development. I have two object types: An object that needs to store a series of user defined conditions. An object that matches zero or more of the conditions defined in the first object. Here's a simple example of how it would run. A user creates several objects of ty...

Get records according to month names irrespective of value existence

Hi, I have to filter data for last 3 months from current date, so that would be to fetch data from Aug to Oct. But value exist for October only in mysql table, so now i want to display record in following format: Month Values Aug 0 Sept 0 Oct 10 But my query only shows October month records as i dont have...

Help with sql query

table 1: id1, name, surname table 2: id1, id2, value id1 is a foreign key for table 2 What is the fastest query to find the table 1 records that do not have a record in table 2 with value = c ? Can you please help me? ...

Case insensitive search in hibernate without criteria

I want to do case insensitive search in hibernate Query. I can do it with Criteria but it is not an option for me right now. The method which fire query takes a query string as input and it is used by other components. Is it possible to enable case insensitive for Hibernate session or prepare criteria object from hql query. ...

MySQL Query Help

I have the following 5 tables: users(user_id) books(book_id, author_id) source_phrases(source_phrase_id, book_id, phrase) synonym_phrases(synonym_phrase_id, source_phrase_id, reader_id, synonym) synonym_ratings(synonym_ratings_id, synonym_phrase_id, rater_id, rating) I am trying to get a query that will select all the books a user has...