Hi all,
I'm having a kind of dummy problem, I need to make a @NamedQuery with a join with other table, some simple thing.
But in all my @NamedQuery I'm only dealing with my mapped Object/Table.
For example in my Object/Table Mapped cars:
@NamedQuery(name = Cars.GET_AVAILABLE_CARS, query =
"select c.id from Cars c where c.status = (s...
Hey,
working with JPA above hibernate impl.
I map my enums by using user-type follow the good practice to store a persistence key to the enum and not the ordinal (which can be changed).
Now, i have a problem to query on the enum field. it seems that hibernate dont execute the user type convert on the name-query.
Any idea?
...
how can i select 12/20/2008 in where clause of sql.
it is sql server 2005.
select * from tblErrorLog
where errorDate = '12/20/2008'
...
I was just playing with adventureworks database in sqlserver. I got stuck in a query.
I wanted to Select all titles from HumanResources.Employee which are either 'Male' or 'Female' but not both.
i.e if title Accountant is Male and Female both I want to leave that title.
I need only those titles where Gender is either Male or Female.
I h...
I tried to create a very simple report with a subreport. The subreport was created separately and was embedded in the data group. The subreport separately gives me the relevant data. and the other main report gives me the intended partial data. But the data intended in the place where the subreport has been embedded is not appearing. It ...
I want to select distinct product_series, but I want all the other columns too.
This is my query as it stands:
SELECT DISTINCT product_series
FROM cart_product
WHERE product_brand = "everlon"
AND product_type = "ring"
AND product_available = "yes"
But this only gives me product_series, but I need all the other columns in that row...
I have a Order Details table.
What I want to do is create 1 query to show
OrderNumber | SKU | QTY | Price | Line Total |
1 SKU1 1 10.00 10.00
1 ---- 0 0.00 10.00
2 SKU1 2 10.00 20.00
2 SKU2 3 1.50 4.50
2 ---- 0 0.00 ...
My database has name records that occasionally contain apostrophes, such as Joe's Bar and I've just coded a query script in PHP that grabs that field and sticks it into a select statement with the usual $query = "SELECT address FROM restaurants WHERE name='$name'"; and the apostrophe in some of the restaurant names derails the Love Train...
Hey, I am wondering how to extract the data from a table in a database onto a table in a page (users.php),
For example:
I want to be able to get all of the usernames and all the id's from my database onto a table.
So if I have in my database:
1 - Fred
2 - Frank
3 - Margret
It will see that I have them user's and id's in the database...
How can I select query the order/purchase history in northwind database? There are 2 tables(orders and purchase order table) then connected to Inventory Transaction table.
...
Hello guys,
after doing a query with F() (see http://docs.djangoproject.com/en/dev/topics/db/queries/#query-expressions), I save the object, but then, I need to save it again. I want to remove F() from the field. If I don't, F() gets called again.
For example
rank.ammountMatchesRanked = F('ammountMatchesRanked') + 1
rank.save() # does ...
I have two database tables, 'Lists' and 'Notes'.
Lists has columns _id, listname
Notes has columns _id, checked, list_id (which is a foreign key of Lists._id), and more columns that aren't relevant to this question.
I would like to create a query that returns four columns:
Lists._id, Lists.listname, the count of all checked Notes in thi...
I have a table containing the following details:
date_info info
2009-06-23 1
2009-06-24 2
2009-06-25 20
2009-06-26 14
2009-06-27 17
2009-06-28 5
2009-06-29 10
2009-06-30 2
etc.
I would like to group the info coloumn by occurrences per week and month, like so:
2009-06-01_2009-06-07 XXX
2009-06-08_2009-06-14 XXX
Grouping by...
The project I'm working on has a lot of IN-queries like:
SELECT something, anotherthing
FROM atable
WHERE something IN (value1, value2, value3)
This is an example of a queru with 3 parameters in the IN-part but the same query could be executed with 1 or 2 or 5 or 10 or ... parameters.
The problem is that each query has an other execut...
I have a class AppUser;
class AppUser {
private String firstName;
private String lastName;
//-- getters and setters
}
I also have another class Student;
class Student {
private AppUser appUser;
private Date dateOfBirth;
//-- getters and setters
}
How would i search for Student John Doe, firstName John, lastName Do...
I basically have two tables:
A(id int, name varchar(10), info varchar(10))
B(id int, item varchar(10))
A
1 A Hello
2 B World
3 C Foo
B
1 apple
1 orange
1 hammer
2 glass
2 cup
Using the following query...
mysql> SELECT a.id, a.name, a.info, group_concat(b.item SEPARATOR ' ')
FROM a
LEFT OUTER JOIN b ON (a.id=b.id)
...
I really am clueless when it comes to object-oriented programmings, so forgive me if this is obvious...
I am using a Zend extension which returns a request as a nested object. I need property a based on if the object has property b. Right now I am using a foreach loop with a conditional to search for property b and, if I get a match, se...
Dears,
I need your help to optimize the query below. Let us assume we have a web application for articles. The software use two table;one is the article table and the second one is the users table. The article table hold the date when the article is created,the id,the body,the title & the section. Let us assume that we have one section ...
Hi,
I am new to R language. I have successfully loaded a query's resultset into a variable. Now I want to access the resultset data by column name and row number. And I need to verify if it is Null (it is shown as < NA > in result) then send a mail by bat file with php. My sample code is below.
library(RODBC)
newconn = odbcConnect("db...
Hey all,
Im pretty proficient in LINQ, but not in SQL. I understand cursors are horrible and shouldn't be used. I know SQL Syntax pretty well, but I am trying to figure out how to convert this query and update to SQL from Linq. I don't know how to go through the Foreach of SQL without using cursors and Im a bit lost on what to do ne...