hi i have a table as follows id,school,address,city,phone,email,fax . There is almost 40 cities . I need to select 1 entry from each city. can any one guide me
I'm new to T-SQL command MERGE so I found a place in my SQL logic where I can use it and want to test it but can't figure out how exatcly should I use it:
IF (EXISTS (SELECT 1 FROM commissions_history WHERE request = @requestID))
UPDATE commissions_history
SET amount = @amount
WHERE request = @requestID
ELSE
INSERT INTO commissions_history (amount) VALUES @amount)
Plase suggest the proper usage. Thanks!
I have a pagination script that displays a list of all pages like so:
prev [1][2][3][4][5][6][7][8][9][10][11][12][13][14] next
But I would like to only show ten of the numbers at a time:
prev [3][4][5][6][7][8][9][10][11][12] next
How can I accomplish this? Here is my code so far:
<?php
/* Set current, prev and next page */
$page = (!isset($_GET['page']))? 1 : $_GET['page'];
$prev = ($page - 1);
$next = ($page + 1);
/* Max results per page */
$max_results = 2;
/* Calculate the offset */
$from = (($page * $max_results) - $max_results);
/* Query the db for total results.
You need to edit the sql to fit your needs */
$result = mysql_query("select title from topics");
$total_results = mysql_num_rows($result);
$total_pages = ceil($total_results / $max_results);
$pagination = '';
/* Create a PREV link if there is one */
if($page > 1)
{
$pagination .= '< a hr_ef="?page='.$prev.'">Previous</a> ';
}
/* Loop through the total pages */
for($i = 1; $i <= $total_pages; $i++)
{
if(($page) == $i)
{
$pagination .= $i;
}
else
{
$pagination .= '< a hr_ef="index.php?page='.$i.'">'.$i.'</a>';
}
}
/* Print NEXT link if there is one */
if($page < $total_pages)
{
$pagination .= '< a hr_ef="?page='.$next.'"> Next</a>';
}
/* Now we have our pagination links in a variable($pagination) ready to
print to the page. I pu it in a variable because you may want to
show them at the top and bottom of the page */
/* Below is how you query the db for ONLY the results for the current page */
$result=mysql_query("select * from topics LIMIT $from, $max_results ");
while ($i = mysql_fetch_array($result))
{
echo $i['title'].'<br />';
}
echo $pagination;
?>
I've got a table (col1, col2, ...) with an index on (col1, col2, ...). The table has got millions of rows in it, and I want to run a query:
SELECT col1, COUNT(col2) WHERE col1 NOT IN (<couple of exclusions>) GROUP BY col1
Unfortunately, this is resulting in a full table scan of the table, which takes upwards of a minute. Is there any way of getting oracle to use the index on the columns to return the results much faster?
Hi all,
ID Name Hidden
1 Mika 1,4,2
2 Loca 0
3 Nosta 4
4 Like 2
can someone give me a query that will return as a result
rows ID 1 & 3
something like this
SELECT * FROM table WHERE Hidden HAVING(4)
Thanks,
I Appreciate
Hi,
SELECT * FROM ABC
WHERE PARATYPE = 'A'
AND MODELID = '50'
AND 'BA1' BETWEEN RAWMIN AND RAWMAX
AND ROWNUM < 2 ;
I have the above query .i have difficulty in converting rownum < 2 in plsql to hibernate query.
Can u help me .it's urgent.
Thank You.
Is it possible to reuse the picker Intent to select multiple pictures instead of one? I haven't found a way and I'm trying to reproduce it with a grid view but my alignment is very poor and my performance is not quite as good as the picker.
Intent photoPickerIntent = new Intent(Intent.ACTION_PICK);
photoPickerIntent.setType("image/*");
startActivityForResult(photoPickerIntent, REQ_PICKER);
I have a report where I need to filter out records where there is a duplicate contract number within the same station but a different date. It is not considered a duplicate value becuase of the different date. I then need to summarize the costs and count the contracts but even if i suppress the "duplicate fields" it will summarize the value. I want to select the record with the most current date.
Station Trans-DT Cost Contract-No
8 5/11/2010 10 5008
8 5/12/2010 15 5008
9 5/11/2010 12 5012
9 5/15/2010 50 5012
I'm trying to select the id of a textArea when it's focused in
<s:TextArea id="textarea1" focusIn="selectId(event)" />
selectId(event){
event.target.id;
}
Problem is TextArea is made up of RichEditableText so target doesn't actually refer to TextArea. I've tried event.target.parent.id but still not getting there. Anyone knows how to get to the bottom of this?
A process running on my machine collects data from various websites and stores it in the local mysql db. Same data is exported using SELECT INTO OUTFILE and FTPed to the shared host every few hours. My hosting provider doesn't allow LOAD DATA INFILE to be executed on the shared host? What are my other options for automated/scheduled load to MYSQL db on my shared host?
Hi all,
Any idea on how to order the results of a MYSQL query by the sum of two columns rather than by a single column?
Select * FROM table ORDER BY (col1+col2) desc
I know that won't work., but I hope it conveys what I want to do fairly well.
Thanks!
Does anyone know if you can run a select statement to return values on the table that the trigger is assigned to from inside the trigger?
Thanks in advance.
Are there any updates in SQL 2008 to allow a variable for the IN of a where clause?
Declare @InParams varchar(100)
Set @InParams = '1,2'
Select * from Category
Where CategoryID in @InParams
Hi,
i have this page.
login: [email protected] password: m
You can see two selects in the filter for which i have this rule in gente.css:
td.select label{
margin-left:12px;
}
The problem: the rule is applied but doesn't appear in the Style tab of Firebug.
Any idea?
Regards
Javi
I want to be able to create a drop-down select box based on the languages my website supports. I can't seem to find a component in Wicket that does this out-of-the-box. How can I do this?
Two (hopefully quick) questions about LaTeX:
How do you number select functions? I'm working in a documentclass{article}, if that matters. I want to have certain functions numbered such as
function1
function2 (1)
function3
function4 (2)
How do you make a sign to evaluate an integral? I know how to do brackets, but is it possible to only make one straight light to the right of the function with the bounds of integration? I can't figure out how to do that.
i am using two table postjob and job location
want to distinct jobtitle
The query is:
select postjob.jobtitle,
postjob.industry,
postjob.companyname,
postjob.jobdescription,
postjob.postid,
postjob.PostingDate,
Job_Location.Location,
Job_Location.PostigID
from postjob
inner join Job_Location
on postjob.postid = Job_Location.PostigID
Where postjob.industry=' Marketing, Advertising'
output of this query
http://www.justlocaldial.com/Industry_search.aspx?ind=Marketing,%20Advertising
I have a list of installed software, obtained from WMI class select * from Win32_Product.
I'd like to deny execution rights for some users on certain software like so:
find the path to installed software
recursively remove execution rights
I find the path to installed software from Win32_Product InstallLocation column. But the PROBLEM is that not all rows in Win32_Product have a value for InstallLocation. What can I do to overcome this? Is there somewhere in registry where I can find this path?
hello, i have a table with some rows.
idClient, name, adress,country,...
i want to know how i can do an insert into this table with auto increment my idClient in my sql request..?
Thx.
edit: i want do a request like this
insert into Client values((select max(idClient),...)
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).
When i request for inbox messages in fql.query using the below query.
SELECT message_count FROM thread WHERE folder_id = 0
It is giving this error.
yyyyyyyyyy is not permitted to requested mailbox permissions from xxxxxxxxx
I often do code review in the following way:
Open the SVN log
Select a revision
Double click on a file...
...and wait
See the changes
Goto 2 or 3 or finish
The 4th step is very annoying. Do you know a solution for this?
Is there any plugings or text editor to auto-complete SQL statement? I am using SQL Server Management Studio (ssms) 90% of time, but most of time I have to type SELECT FROM WITH(NOLOCK) WHERE blahblah. Trying to find a more efficient way. Thanks.
Query:
select emp.empname as Name, dep.depname as Department
from Employee as emp
inner join Department as dep on emp.depid=dep.depid
where emp.id='2'
How can I change this to linq to sql?
I have an object, 'Response' that has a property called 'submitter'. Submitters can be one of several different classes including Student, Teacher, etc...
I would like to be able to execute a criteria query where I select only responses submitted by teachers - so this means putting a class restriction on an associated entity. Any ideas on this? I'd like to stay away from direct SQL or HQL.