DataSource Controls :: Excluding Zero Numbers From The Query?
Jan 4, 2010
Is there any way, I can exclude the whole row if one particular column has zero in it. I have this query
select first_name, last_name , employee_num, cubeNumber, extension
from tblData left join tblfacility
ON tblData.employee_num = tblfacilit.employee_num
left join tblextension ext
on tblData.extension = ext.extension
tablExtension has phone number extension in it. If we don't know someones phone extension, we put zero for their extension, now there are tons of people who have zero extension.when I run this query, it returns same name lot of times with different cubeNumber so I get
Fisrt_name last_name employeenum cubeNumbae extension
a ax 1 12 0
a ax 1 13 0
a ax 1 14 0
b bx 2 12 0
b bx 2 13 0
b bx 2 14 0
Both emploee a and employee b extensions are zero in above case. I want both a and b to be displayed only once .Right now it is displaying them so many times with all the cubesNumber that have extension zero.
View 8 Replies
Similar Messages:
Jul 6, 2010
I need to create a SELECT statement for a table that excluded the TOP 10 records.
"SELECT TOP 10 field1,field2,field3 FROM AppData ORDER BY field1 DESC" returns the first 10 records from the table but I need to retrieve only from the 21st record onwards.
I simply don't know how to do it because I'm not that strong with SQL. I searched the forum for some answers but can't find a solution that I can understand.
View 4 Replies
Apr 25, 2010
I need to know if I've done something wrong, or if the message I'm getting is nothing about which to be alarmed.I'm getting "The relationship '....' has columns that are not part of the key of the table on the primary side of the relation ship which is not supported, the relationship was excluded.
I built four tables, each with one foreign key. I'm assuming I haven't done anything wrong or unusual with my four tables (SQL statements generating the tables are shown below).However, I don't get any lines connecting tables together and all the examples I've seen today seem to have no problem with drawing the connecting lines all over the place.
[Code]....
View 6 Replies
Mar 30, 2010
I have to write a stored procedure to get the biggest two values out of three in three different columns in the same table.
I have a table , for instance,
total marks1 - column1 ( eg values - 1000)
total marks2 - column 2 (eg values - 500)
total marks3 - column 3 (eg values - 800)
i have to get (return the value) 1000 and 800.
View 6 Replies
Feb 3, 2010
I currently designed a school result portal. If the students want to view their result, they input their student school number in a text box to search out their result. But this is not secured because anybody can look up any students result if you have the number which is even written on their school uniform for identification.
I have being trying to secure this result by trying to generate or code special numbers that the students will input with their school number. The special numbers will be random numbers and may be from 10 and above, it might even contain letters. How do
I code this. I believe this is the best asp.net forum. I want the students to be inputing this special unique numbers and their student numbers so that there result will be avaliable to them.
View 2 Replies
Mar 8, 2010
I am looking for a function or procedure in sql server which assists me in figuring out the records which is having Transposed numbers. E.g one record is having invoice number as 1234 and another record is having invoice number as 2134(this is the definition for transposed records for me). My another problem is that the length of invoice number is not known. It can be from 1 character to 15 characters or more than that.
View 2 Replies
Jul 22, 2010
i need one sql query for join two numbers...example:
a=15
b=45
c=a+b that answer i need 1545.. not 60...i dont about that query..
View 2 Replies
May 12, 2010
I want to know the Maximum numbers of records Handled by SQL SERVER???
View 2 Replies
Jan 29, 2010
I need to insert multiple records using a script.
My table is
Region
(
ID int,
Name varchar(50),
Description varchar(51)
)
One thing I can use is to retrieve the max(ID) from region and store it in a variable and increment the variable sequentially and insert. But, if any other user inserts a record while I am executing this script then max(id) might clash with the id inserted with other user causing my script to fail.
Is there any other option to insert record sequentially base on the highest number in the table.
View 3 Replies
Aug 22, 2010
1. I have a GridView on my page and it uses sqldatasource with parameterized query. What I want to do is, on page load (where nothing has been selected so no parameter supplied), I want it to query everything (something like SELECT * FROM [this_table]) but since my SelectCommand is something like
SELECT * FROM [this_table] WHERE [this_column] = @someParameters AND [that_column] = @someParameters.
Can I play around with default value to achieve something like that but how ? Now, when the page loads, it doesn't show anything (No Gridview).
2. On my page, I made something like (username, gender, address, and more) and one single search button. That means, no single control enable auto postback. What I am trying to accomplish is building dynamic query
(if username specifed -> SELECT * FROM [this_table] WHERE [username] LIKE @username).
If both username and gender are specified (SELECT * FROM [this_table] WHERE [username] LIKE @username AND [gender] = @gender) and you know the rest. How can I do this using GridView and SqlDataSource ? To my knowledge, I can only specify one SELECT statement in a sqldatasource.
View 11 Replies
Jan 15, 2010
[code]...
This query works perfectly on the query analyser.
But when configuring the Table adapter ,I try executing the query and i get 0 rows affected.
What could I be getting wrong in this case.
NB:Existing GalleryID has been supplied.
View 1 Replies
May 17, 2010
By right clicking on my database i created a query in server explorer. But where are this query stored can't find them back. I should aspect that their is a folder query's like there is a folder tables but this isn't the case.
View 10 Replies
Mar 10, 2010
select Groupid,GroupName,onorusername from palgroup where groupid in (select distinct Groupid
View 5 Replies
Jan 21, 2010
I've got a query such as
Dim MediaQuery =
From m
In dB.DOWNLOADS _Where m.ID = id _Select
which returns a record from the database. One of the fields in the record is a FK to another table. I need to read this value to be able to set a dropdown based on the ID but I can't work out how to access it. For a standard record I can just do the following txtTitle.Text = MediaQuery.FirstOrDefault().TITLE
However with the foreign key it doesn't work like that. I've tried drpGroup.SelectedIndex = MediaQuery.FirstOrDefault().DOWNLOAD_GROUPS.ID where DOWNLOAD_GROUPS is the FK field but it returns Object reference not set to an instance of an object. If you're simply wanting to read some values from a single db record in the entitiy framework and one is a foreign key how should I go about getting the value?
View 2 Replies
Sep 3, 2010
So we use formviews all over the place that recently we've started putting user controls inside that have databinding controls inside them. In this instance it's a grid so
<formview>
<edititemtemplate>
<dynamiccontrol DataField="name" />
<customGrid DataField="addresses">
<columns>
<dynamiccontrol DataField="city" />
</columns>
</customGrid>
</edititemtemplate>
</formview>
That's the basic sitch. We have the customGrid, a usercontrol, bind to a collection on the main DataItem, and it contains dynamiccontrols (DD4) in its column templates so stuff in the cells displays right. (in reality, the customGrid is inside a dynamiccontrol like all the other fields here and is loaded based on ui hints, I've just stuck it in the pseudo-markup here for illustration). This works a charm, up until you try and update the formview. At that point, the FormView grabs all the keys from all the dynamiccontrols in its edititemtemplate, including keys and values from dynamiccontrols insde the customGrid control. Obviously this doesn't work as those are for an "address" object or something, and the formview is bound to a "person" object. What i desperately need is a way, inside customGrid, to stop FormView from getting out all the dynamiccontrol keys and values inside it. Overriding DataBindChildren doesn't work, nor DataBind. I don't know at what point or how the FormView queries its instantiated template for all the 2-way databinding controls it has inside it, but if I could get at that maybe I could figure something out. Or else, if I could make the customGrid stop sending back all the values inside it.
I tried overriding the formview's OnItemUpdating but that only so much; I can remove entries from the e.NewValues collection if they don't exist on the DataItem, but that doesn't if your custom sub control is binding items with fields of the same name as your main dataitem. There must be a way to abort this 2 way databinding in the custom control.
View 1 Replies
Dec 27, 2010
i need to caluculate diffrence between two dates exculding saturdays & sundays
string startdate1 = 12/01/2010;
string enddate1 = 12/31/2010;
datetime diff = Convert.todatetime(startdate1 - endate1) how to exculde weekends
View 1 Replies
Feb 15, 2011
I would like to to make a UI with a panel of numbers, and when hovered above one of them ten the number becomes larger. something like that:
[URL]
I want that when I press a numbers it shows it's value in some other textbox. In which .NET technology is it possible to do it? Windows Forms? WPF? other?
View 6 Replies
Apr 21, 2010
I am using Querystring "ddl4" to pass on value of a drop down list to the next page where I am using that value in the WHERE clause of a SQL command. I also need to check whether ddl4 is blank or not which I do using If Else in SQL command. I am not able to run the query where the Querystring ddl4 IS NULL
This is the sample link with the Querystring ddl4 carrying a blank value:
[code]....
View 2 Replies
Apr 13, 2010
I have one query in my project (saved in folder SQLQueryes, Query.sql) and i need to execute it. Also, i have one parameter in script and i need to include him also. How?
View 8 Replies
Feb 18, 2010
SQL Query with IF and Select
View 2 Replies
Jun 10, 2010
if there is no relation bettwenn two tables why do i need union for example like below Please
can u inform me
SELECT categoryId
FROM categories
UNION
SELECT shipperId
FROM shippers
View 3 Replies
Jun 25, 2010
I´m using Linq to Sql in my asp.net application, but the problem is:I have a query like this:
[Code]....
My query is not returning anything, how do I do to get this?my problem is with this interval I need to have.
View 2 Replies
May 13, 2010
i want to know that should first name and last should be kept as sperate field or merged into single attribute. The Basic problem i am facing to keep first name and last name in seperate fields is that i cannot effectively use like query for searching a record by name
View 7 Replies
Mar 15, 2010
I have table in database with xml field and data like below
[Code]....
there are no records found
View 1 Replies
May 26, 2010
How do I use a Parentheses in an SQL query, example:
SET [myrow] = 'New Value' WHERE [myrow] = 'my (old) value'
View 2 Replies