Hi,
I have a person table that contains the following fields:
id, name, parent_id.
the parent_id is actually a FK for column id.
the data should look like this (Like a pyramid):
"id" "name" "parent_id"
"1" "I am the Top Father" "1"
"2" "My Father Is 1" "1"
"3" "My Father Is 2" "2"
"4" "My Father Is 2" "2"
How is my bean suppose to look like?
Thanks
Following is the command to fetch maximum salary form empsalary table in mysql
select max(salary) from empsalary;
but I want to fetch employee who got fourth highest from the list of employee.
I don't want to use trigger or function because I know there is direct command to fetch.
hi friends,
I am trying to insert data into particular table through pl/sql stored procedure,my requirement is while inserting i should generate PRIMARY KEY values for particular column and also i should return that PRIMARY KEY value to output and one more thing is that for another column i should validate my string such that it should contain only characters not integers.
please help me in writing code for the above requirement
Thanks and regards
thulasi policherla
i am calling the data from xml in table view. after the the first row of data in tableview, my second row is empty in tableview, and from third row data is available. but my last data for row is missing from tableview, because of the second row.
how can i fill that second row.
can any one explain hiow this query works..It's for getting the Nth largest elemet from a table.here it's 4 th largest
SELECT a.ID
FROM tblitem a
WHERE (4) = (select count(*)
from tblItem b
where b.id < a.id)
Thanks in advance
Hi,
I am trying to learn C++ maps. Was just wondering about the implementation of STL map. I read it employs Binary search tree.
Is there a implementation of hash table in STL?
How exactly do STL map stores Key Value pairs?
hi,
i am using php/mysql.
i have a product table .
in which most product have starting name with number.
i want to listout all products start with any number.
any one have idea about it....
I know I am going about this in an unusual way, every tut I've seen uses multiple tables, but due to the way the rest of my site works I would like to create a chained select which operates using a single table.
My table structure is:
----------------------
|Catagory|SubCategory|
|01|cat1 |subcat1 |
|02|cat1 |subcat2 |
|03|cat2 |subcat1 |
|04|cat2 |subcat2 |
----------------------
The code I have so far looks like:
<tr>
<td class="shadow"><strong>Category:</strong> </td>
<td class="shadow">
<select id="category" name="category" style="width:150px">
<option selected="selected" value="<?php echo $category ?>"><?php echo $category?></option>
<?php
include('connect.php');
$result1 = mysql_query("SELECT DISTINCT category FROM categories")
or die(mysql_error());
while($row = mysql_fetch_array( $result1 )) {
$category = $row['category'];
echo "<option value='". $row['category'] ."'>". $row['category'] ."</option>";
}
?>
</select>
</td>
</tr>
<tr>
<td class="shadow"><strong>Sub Category:</strong> </td>
<td class="shadow">
<select id="sub_catgory" name="sub_category" style="width:150px;">
<option selected="selected" value="<?php echo $sub_category ?>"><?php echo $sub_category ?></option>
<?php
include('connect.php');
$result2 = mysql_query("SELECT sub_category FROM categories WHERE ")
or die(mysql_error());
while($row = mysql_fetch_array ($result2 )){
echo "<option value='" . $row['sub_category'] . "'>". $row['sub_category']. "</option>";
}
?>
</select>
</td>
</tr>
On the second select I am not sure how to state the WHERE clause. I need it to display the subcategories which have the same category as selected in the first select.
PART 2 how would I include AJAX in this to preload the data so i don't need to refresh the page.
Could someone either help me finish what I've started here or point me to a good tutorial.
thanks
I am trying to get the value of a cell in a table view but it won't let me. If someone could help that would be great.
int numberOfChecks = -1;
numberOfChecks = numberOfChecks +1;
if ([objectsForTable count]-1 >= numberOfChecks) {
UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:numberOfChecks];
NSString *cellTitle = cell.textLabel.text;
}
I am getting data from a query and processing it using Javascript in the xaction file.
Now I want to pass the processed data (a 2D array) down to a prpt where it will be used to generate graph and table.
What is the format in which Javascript would generate the data and how is it passed to and received by the prpt file from the xaction.
Thanks...
Hi everyone,
I want to crate new table for each new user on the web site and I assume that there will be many users, I am sure that search performance will be good, but what is with maintenance??
It is MySQL which has no limit in number of tables.
Thanks a lot.
I have 'Service' table and the following column description as below
Is User Verification Required for service ?
Is User's Email Activation Required for the service ?
Is User's Mobile Activation required for the service ?
I Hesitate in naming these columns as below
IsVerificationRequired
IsEmailActivationRequired
IsMobileActivationRequired
or
RequireVerification
RequireEmailActivation
RequireMobileActivation
I can't determined which way is the best .So, Is one of the above suggested name is the best or is there other better ones ?
How can I change the Default Size of the filterBy text box in Rich Table? In all the columns, it has a same (fix) size.
I used the property width, but it didn't work.
We had a process that crashed while trying to manipulate an expected mysql record set, running the offending query from the mysql cli showed the following.
mysql SELECT ...;
ERROR 1030: Got error 127 from table handler
Is there a way to easily recreate this condition so we can validate our fix ? (production DB was already repaired).
I am having a hard time understanding how to change the width of columns when creating a table view.
I know you can set the width in pixels of a column but that is not what I want to do.
Say, for instance, I have 2 columns and want each column to take up half the screen. How do I do this without explicitly setting the pixels, so that my code can work on multiple screen sizes?
I was trying to run the following query
UPDATE blog_post SET `thumbnail_present`=0, `thumbnail_size`=0, `thumbnail_data`=''
WHERE `blog_post` NOT IN (
SELECT `blog_post`
FROM blog_post
ORDER BY `blog_post` DESC
LIMIT 10)
But Mysql doesn't allow 'LIMIT' in an 'IN' subquery.
I think I can make a select to count the table rows and then make an ordered update limited by 'COUNT - 10', but I was wondering if there is a better way.
Thanks in advance.
I have 2 lists in my program one that store objects of type student and another one which stores objects of type marks.
I have 3 methods one that inputs the details of the students, one that inputs the marks and one to view student details and their marks. My question is how I can use a hash table to get the Id of a student and then use it to input the marks and then how to retrieve both the student details and their marks altogether.
Please help me if you can.
hey guys,
a curl function returns a string $widget that contains regular html - two divs where the first div holds a table with various values inside of <td>'s.
i wonder what's the easiest and best way for me to extract only all the values inside of the <td>'s so i have blank values without the remaining html.
any idea what the pattern for the preg_match should look like?
thank you.
My table looks like this with duplicates in col1
col1, col2, col3, col4
1, 1, 0, a
1, 2, 1, a
1, 3, 1, a
2, 4, 1, b
3, 5, 0, c
I want to select distinct col1 with max (col3) and min(col2);
so result set will be:
col1, col2, col3, col4
1, 2, 1, a
2, 4, 1, b
3, 5, 0, c
I have a solution but looking for best ideas?
Hi All,
Is there some way to backup the data in a table in sql server by using sql scripts. Note: I dont want to take the backup of the whole database.
And later on restore the same data back in case of any failure.
Please suggest some solution.
Iam quite new to functions in SQL and I would like to create a function to compare values in a MySQL table against previous and I am not sure how to do this.
For example (iId is the input value)
DECLARE pVal INT(20);
DECLARE val INT(20);
SELECT price INTO pVal FROM products WHERE Id=iId;
SELECT price FROM products;
IF price == pVal THEN
SET val = price;
END IF;
Thanks
On the Members table are columns "MemberID" and "PointsEarned".
I want to update the PointsEarned column from the result of this query:
SELECT m.MemberID, m.UserName,
( (SELECT COUNT(*) FROM EventsLog as e WHERE e.MemberID=m.MemberID AND e.EventsTypeID=2)*10 ) +
( (SELECT COUNT(*) FROM EventsLog as e WHERE e.MemberID=m.MemberID AND e.EventsTypeID=3)*3 ) +
( (SELECT COUNT(*) FROM ChatMessages as c WHERE c.MemberID=m.MemberID)*.1 )
as PointsEarned
FROM Members as m
Can anybody tell me how I should do it with a single query?
Thanks!
hello i have a issue and i want your help i have a table which is called citylink[10][2]
and i want to make a check before i move on in my code if it's full to continue if it's not to break!!i know that i should use an if loop but i don't know what to put inside it!!
I try to draw a table on a panel in C# Windows Form by using GDI+. The problem is that when I minimize the application, my drawing disappears. How can I avoid this and why acting this way?