DataSource Controls :: Combine Multiple Columns Into One For Select Statement?

May 14, 2010

This question is for wrapping up work on a database driven AJAX AutoComplete Control that I am using to provide keyword hints to user on search pages. Each record has 6 columns for keywords where each column is for an advertiser to add a keyword. These are used in meta keywords tags, but I also want to use them for AutoComplete. The problem is that I don't know how to write a SELECT statement in Visual Studio that treats all 6 keyword columns as if they were all one column. I am looking for something like

SELECT (keyword1 + keyword2 + keyword3) AS Keywords
FROM (Merchandise)
WHERE Keywords LIKE @term

The only other thing I can think of the gain this level of functionality would be to combine them into a new table.

View 7 Replies


Similar Messages:

DataSource Controls :: Statement To Combine Columns Of Different Tables

Feb 4, 2010

I have 2 tables and I want to entries of the tables into something like this:

Table 1: Table 2: End Result:
a 1 a - 1
b 2 a - 2
... ... b - 1
... ... b - 2
... ... ...

View 3 Replies

DataSource Controls :: Exclude Xml Data Type Columns From Select * Statement In Sqlserver?

Jun 16, 2010

I want use select * from sample (tablename) ,which returns only those columns from sample table which does not have xml data type.

note : sample table contains some columns which have xml data type .

View 6 Replies

DataSource Controls :: Select Statement By Multiple Dropdownlist

Feb 25, 2010

if I have three Dropdownlist A, B, C, how can I write a select statement to get data from sql server based on the dropdownlist selected.e.g. if user select dropdownlist A, select * from table where A = dropdownlist A but if user select dropdownlist A and C, then select statment is "select * from table where A = dropdownlist A and B = dropdownlist B or if selected A, B, C.......how can I settle so many choice.

View 2 Replies

DataSource Controls :: Select Statement Pulling Multiple Times From Same Row

Jan 5, 2010

[Code]....

I have a select statement that is supposed to be filling grid with information from an income table. It's only supposed to pull if the income is from the current fiscal year or is less than 1 year old. Currently, what it does is pull multiples of rows and also rows from past income years but only if there is a mixture. For instance, if a person has income from 2005 and 2010 what it will show is this

Income 2005
Income 2005
Income 2010
Income 2010
Income 2010

Does anyone know what I've done wrong? BTW, those results are exact, old income is shown twice, current is shown 3X

View 16 Replies

DataSource Controls :: How To Select Multiple Columns Into IQueryable

May 18, 2010

How do I select multiple columns into IQueryable<Employee>?

View 2 Replies

DataSource Controls :: How To Select Multiple Columns With Distinct Key Word

Jan 2, 2010

there are multiple rows with same SubContact_No and with same value of some columns. for a single column I am firing query like

Select distinct (Financial_Status) from mtblSub_Contract where SubContract_No=@SubContract_No";

it's working fine.... (it's ok with a Single column)

But Now I need multiple columns value so how to query for this.

Select distinct (Financial_Status, colums2, column3) from mtblSub_Contract where SubContract_No=@SubContract_No"; is not working

So how to do that.

View 5 Replies

SQL Server :: Trying To Sum Two Columns In One Select Statement?

Jan 3, 2011

Is it possible to sum to clolumns in one select statement?

[Code]....

[Code]....

ID sUM(aMOUNTpAID) sUM(aMOUNTdUE)
1234 506.64 4340.00

The actual rows look like this:

1234 10.00 5.00
1234 200.00 100.00
1234 130.00 130.00
1234 166.64 1000.00
totals 506.64 1235.00

View 7 Replies

DataSource Controls :: SQL Statement - Don't Want To Return Duplicate Columns

Mar 11, 2010

I have the following simple stored procedure:

ALTER PROCEDURE GetadiByPhiNo

@PhiNo int

SELECT adirefno, adidescription

FROM aditable

WHERE adiphino = @PhiNo

Here is an example of data returned:

1 Skin diesease

2 Cough

3 Cough

4 Rash

You notice "Cough" is in the adidescription column twice. I would like to return only one row for adidescription with the same value. So what I want returned is this:

1 Skin diesease

2 Cough

4 Rash

View 8 Replies

Forms Data Controls :: How To Select Statement For Multiple Category

Mar 1, 2011

im creating advance search for my project and end up with the problem of select statement format for 2category.

here is example:

i have advancesearch that has checkbox wherein you can select multiple checkbox. example is selecting category, for example ihave 5 category as shown below.

Category

News Sports Opinion Editorial Literary i did tried someformats for my select statements to make it work for 2 or more category, but i just cant get the right format of the select statement.

example if i select the following.

if selected is category 'Sports'

it wil work with this: " 'Select * MyTable1 where [Category Title]='Sports' "

if selected are category 'Sports' and 'News'. what must be the format for my selectstatement for 2 or more category in the same fieldname? should it work with this?

" 'Select * MyTable1 where [Category Title]='Sports','News'" no, how could i make it work. what must be the right format?

View 2 Replies

DataSource Controls :: Select Top Record From Sql Statement

Mar 17, 2010

If I run the following SQL script:

[Code]....

View 3 Replies

DataSource Controls :: How To Select Statement For Some Scenario

Apr 24, 2010

I want the select statement for the above scenario.

View 2 Replies

DataSource Controls :: INSERT SELECT Statement?

Apr 30, 2010

How would you handle an INSERT that gets some values from another table using SELECT, where you wanted some values to come from the source table record and other values to come from a different parameter source like a session value? Is this possible?

View 3 Replies

DataSource Controls :: Executing The SP Across Select Statement?

Apr 17, 2010

I need to execute the stored proc accross the parameters resulted from select statement

I have created one stored procedure which require one parameters ( username ) ..

i need to execute this SP accross the Select Statement which lists all the username

somethibng like :

Set @username = (Select usename from my table)
EXEC dbo.Duplicate_Data @username

View 7 Replies

DataSource Controls :: Select Statement Across Three Tables?

Mar 17, 2010

[Code]....

Select statement across three tables

View 15 Replies

DataSource Controls :: Select Statement Excluding TOP 10?

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

DataSource Controls :: Select Statement To Get Order By Date?

Apr 27, 2010

i get this data from history table for a paricular ConsignmentNo.

................

i want the sql statement. 1st condition is sql statement should be order by CurrentStatusDate.

.......................

View 13 Replies

DataSource Controls :: Updating Field Using Select Statement?

Feb 24, 2010

I have a table "Table1" which has mani 3 fields ID: int,

Date1: datetime,

Date2: datetime

All fields are filled except Date2, so I want to copy the records in Date1 to Date2I tried this query, but it didn't work

[Code]....

View 3 Replies

DataSource Controls :: Return Values From Select Statement?

Feb 8, 2011

I have a select statement in a stored procedure and want to be able to retrieve the key column value (PRODUCTID)and return it as Output when Select statement is executed on input Parameter (NAME).

addition, return two further output values (COST,TOTAL).

note the grid control expects to receive all values at once! so i need to get out these values at the same instance of execution.

Select productID,COST,QUANTITY,NAME,TOTAL,DATE
FROM PRODUCTS
WHERE NAME=@NAME

View 2 Replies

DataSource Controls :: Count From Several Tables In One Select Statement

Mar 14, 2010

I am trying to count records belonging to a certain person in three different tables in a single select statement. The database looks like this:

Player
-PlayerId
-Name

Game
-GameId
-TournamentId
...

Goal
-GameId (FK->Game.GameId)
-PlayerId (FK->Player.PlayerId)
-Assist (FK->Player.PlayerId)

Card
-CardId
-GameId (FK->Game.GameId)
-PlayerId(FK->Player.PlayerId)

I want to select the number of goals, assist and cards a player has in a specific tournament. I tried with this query but then the goal and card column shows the sum of the number of rows matching the playerid in the Goal table and the Card table...For example if there is two matching rows in the goal table and three matching rows in the card table, I get 5 in both these columns in the resultset.

[Code]....

View 3 Replies

DataSource Controls :: SQL Select Statement - Values To Appear In Same Query

Feb 15, 2010

I am having difficulty selecting data from 2 tables that do no share a primary key value. For instance, I have an actual table, a forecast table, and a GLText table. I may have an actual value but not a forecast value but I need them to appear in the same Query (like the query results shown below). I can get all values to appear in each table but have been unsuccessful in getting all values from both tables.

View 5 Replies

DataSource Controls :: Display The Table Name In The Select Statement?

Feb 23, 2010

I need to display the table name in the select statement. how?

exact question:

we have common columns in two tables. we are displaying the records by using

select column_name from table_name_1 union select column_name from table_name_2

But the requirement is, we need to display the source table_name along with the data. consider a,c are present in table_1 and b,d are present in table_2. we need the output in the following way

eg: column_name table_name a table_1 b table_2 c table_1 d table_2

View 2 Replies

DataSource Controls :: Use A Stored Procedure In A Select Statement?

May 25, 2010

Just quick question, is it possible to Use a Stored Procedure which has a parameter in a select statement,, I mean something like the following

SELECT A, B

FROM Something

-- Something is the name of the Stored Procedure which take date parameter

View 2 Replies

DataSource Controls :: How To Add Condition In Select Statement For Datedifference Function

Mar 5, 2010

this is my select Statement.:-

Select (datediff(day,db_TargetDate,getdate())) from tbl_abc

in select statement only i wanted only those record in which datedifference is less than 5.

declaration of variable & then conditional checking is not wanted me because i wanted result is into select statement only & not using print statement.

View 11 Replies

DataSource Controls :: For Each Row In Select Statement - Exec Stored Procedure

Apr 21, 2010

Ive been banging my head against the wall for the last 2 days with this query I am trying to produce. I have an application that creates requests and these requests have status codes dependant on how far along in the process they are : new request, awaiting approval, approved, in progress, complete When a request is moved to the next status, it Inserts a row into an auditing table, so we can track who moved it onto the next status, along with a timestamp. There are Service Level Agreements in place that mean that a request that is currently 'In Progress' must be actioned to 'Complete' within 5 days. I have been asked to create a query that will return all records that fall outside of this SLA. My main problem is trying to Select the time from the audit log for 'In Progress' and 'Complete' status codes. It would be simple if i only had to find one of the times, as i could add a "WHERE StatusCode = 'complete' clause to the query My Audit table is structured as follows:

[RequestID] [Request Status] [UserID] [CreateDate]

So far I have been successful in querying the table by using the DATEDIFF() function as below:

SELECT
DateDiff
(day,
( SELECT
top 1 CreateDate
FROM audit_tblRequest
WHERE RequestStatus
= 'In Progress'
AND RequestID
=
@RequestID Order
by CreateDate
DESC)
,(SELECT
top 1 CreateDate
FROM audit_tblRequestWHERE RequestStatus
= 90AND RequestID
=@RequestID
Order
by CreateDate
DESC)
)

This will return the difference in days to me, however, i cannot figure out how to integrate this into a query that will be run across all RequestIDs. I was wondering if there was any way to bundle the DateDiff function into a stored Procedure and be able to call it For Each RequestID in the result set I would need to pass the requestID as a parameter, and also add some If Else logic to only return records outside of the 5 Day SLA. Im sure there are some patches in the above logic, but my brain is about to explode and I needed to type it all out before calling it a day for today.

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved