I'm looking for an efficient query to return the child nodes of a tree .
The data structure is:
`ct_cid` int(10) unsigned NOT NULL default '0', // the data
`ct_level` int(10) unsigned NOT NULL default '0', // the level (0 = topmost)
`ct_parent` int(10) unsigned NOT NULL default '0', // parent ct_cid
I need to make sure there won...
I need help with a query?
I have 2 tables reservations & units among others.
Table reservations has columns ResId,rfrom(datetime),rto(datetime),status(int),UnitID(foreign key).
Status 2 means its confirmed.
I need to get all free units in requested period, query needs to return only that units for which there aren't confirmed reservatio...
The query:
SELECT ct_cid as level1 FROM cat_tree WHERE ct_sid=$sid_int AND ct_parent =$cid_int)
UNION (SELECT ct_cid as level2 FROM cat_tree WHERE ct_sid=$sid_int AND ct_parent IN level1)
The query is supposed to find the child nodes up to 2 levels of a tree node.
I get "You have an error in your SQL syntax; check the manual that corr...
Below is the mysqli query that is being performed, anyone know what I get such error:
$sql = mysqli_query($db, "INSERT INTO `tbl_bugzilla`
(`id`, `by`, `title`, `content`, `date`, `application`,`priority`, `assigned`, `status`)
VALUES (NULL, '".$_SESSION['exp_user']['username']."', '"
.$_SESSION['exp_user']['username']...
Spent a working day on this.
I have
class Box
has_many :users, :through => :subscriptions
end
I also have custom insert_new_users and associate_with(new_users) methods which use multiple INSERT to do their job quickly. Anyway, they work fine. I also have this line at the end of "associate_with" method:
def associate_with
# mysql...
I am just starting to use XML within SQL Server 2008. I have the data in the XML, but I am having a hard time finding good examples of querying the data. Can someone point me to a good place to start? For example, I would want to find all rows within SQL server that contain a certain criteria within the XML like all rows where the XML...
I have a table called baskets with these columns:
basket (name of the basket)
colour (colour of the basket)
apples (the number of apples in the basket)
bananas (the number of bananas in the basket)
oranges (the number of oranges in the basket)
pears (the number of pears in the basket)
peaches (the number of peaches in the basket)
Wit...
Hi guys
This is a sample of the data that I have.
-ID- -Rank- -Type- -Status- -Amount-
1142474 2 Under Offer Approved 23
1148492 1 Present Current 56
1148492 2 Under Offer Approved 3
2273605 1 Present Current 24
Where the ID is the same I only want the record with the highest rank. So the end result of the query....
Suppose that I have the following HQL:
String hql = "select e.aField from MyEntity as e";
If I want to refactor and change the name of the MyEntity's member variable aField to something else, I also have to change all occurrences in the whole code in Strings. If I forget to change one hql string the code breaks.
How can I avoid this ...
Let's say that I have a 'Scores' table with fields 'User','ScoreA', 'ScoreB', 'ScoreC'. In a leaderboard view I fetch and order a queryset by any one of these score fields that the visitor selects. The template paginates the queryset. The table is updated by a job on regular periods (a django command triggered by cron).
I want to add a...
I already used Microsoft SQL Server 2005 and found really easy to execute single/multiple lines of an sql query.
Example:
insert into tablea
($vala, $valb, $valc)
values
($vala, $valb, $valc);
insert into tableb
($vala, $valb, $valc)
values
($vala, $valb, $valc);
How can I execute the second part only? In MSSQL i will highlight the...
Hi, i need to make a query in a wordpress plugin but i couldn't find a wordpress function and i'm not sure is right to use mysql_query
the functions i've found enable ordering and grouping but i need to use also join and in (list)
is there a way?
thank you
...
I have an Access application that use the classical front-end/back-end approach. Yesterday, the backend got corrupted for a reason I don't know. So I opened the backend with Access 2003 and access asked me if I wanted to repair the file, I said yes and it seemed to work.
I can open the database see the tables contents and run most of th...
Here is the problem I am trying to solve. I have a table where I store a StartExclusionDate and EndExclusionDate and set an ApplyDate for my object (called Exclusion). There can be many ExtId entries in the table.
I want to get the ApplyDate from the last continuous record where a date passed to the query is included between the Start...
I have a table in MySQL:
Col1 | Col2
a A
a B
c C
a B
i want to create a table like this:
col1 | col2 | freq
a A 0.33
a B 0.67
col1 is a specified item in Col1. col2 is distinct item that has occured with the specified item(i.e. a). freq column is the frequency of appearence...
I've the following lucene index:
Document A
item = level:(1)
item = level:(2)
item = level:(3)
Document B
item = level:(1)
item = level:(4)
Suppose I want to search for all documents which contain level:(1) AND level:(2) ?
The Lucene query could be like:
"item:level\:\(1\) AND level\:\(2\)"
but is it also possible to do something...
Question is already posted on June 4, but still am not get the Proper answer
Again
Table Structure:
T_Person – Table 1
CARDNO
168
471
488
247
519
518
331
240
518
386
441
331
T_Cardevent – Table 2
CARDEVENTDATE CARDEVENTTIME
20090225 163932
20090225 164630
20090225 165027
20090225 165137
20090225 165147
20090225 1657...
My project was originally generated by seam-gen and the action "List" bean, OfficeViewList looks pretty much like it did when first generated.
The bean extends EntityQuery.
Now I want to order the results. What is the best way to do this?
Do I want to add some kind of "order by" class to my EJBQL? Or do I want to set the select order...
So what I'm trying to do is a bit tricky. I'm trying to come up with a sql query that will be able to return counts for specified time frames. So I have a table 'v'. Here is some basic data from Table v
Table v
_____________
id p_id created_at
1 1 2009-06-09 18:54:17
2 2 2009-06-09 21:51:24
3 2 200...
I'm using RoR + acts_as_solr to query a Solr database.
I'm used to using "*" to select all, thanks to MySQL, but that command fires an exception in Solr. Are they other wildcards I can use? Suggestions? Thanks!
...