I have an existing view that returns data in the following format.
option_name product_id
XSMALL (2-6) 17854
SMALL (6-10) 17854
MEDIUM (10-14) 17854
LARGE 18232
How do I return this data in a comma separated field formatted like this, based on sending a product_id to the function?
...
I am populating a DataGrid with the following LINQ code :
Dim myClients = From p In dc.Persons _
Select p
I can navigate my DataGrid, make changes and then click on a button that calls
dc.SubmitChanges()
All of this works well and updates SQL Server.
I then wanted to add a single additional colu...
Strangely my app works in the simulator.
When run in debug on my iTouch, I get the error , "Unknown Error" when I try to run a "Update" sql command.
I can read from the SQLite db fine though. The database is in the root and it's being found as the open() command works.
I'm using MonoTouch but think it may be a more general error. The ...
How to Fire a trigger when you do TRUNCATE (instead deleted) in MSSQL
...
My database is MS SQL 2008.
I"m basically merging some sets of data together from two or more databases to end up with one owner of a set of data possibly related by two fields.
Table
ID Name Code
1 Ben 1
2 Ben 1
3 Frank 1
4 Frank 2
5 Mark 2
6 Mary 3
7 Chuck 3
8 ...
This is a general question that keeps coming to my mind. Is there any major disadvantage in using the SQL Server 2000 system tables in SQL Server 2008? It is a good practice to use system views, but in simple words, Why?
...
Are there any tools or online resources (FREX tutorials) that would help a neophyte with database normalization?
...
The following query returns ORA-00904 error: SATIS: Invalid identifier. When I remove the line HAVING satis > 0, it works. What should I do?
SELECT donem, bolge_adi, sehir_tasra "1=Ş, 2=T",
COUNT(DISTINCT mekankodu) "M.SAYISI",
SUM(b2b_dagitim + b2b_transfer - b2b_iade) satis
FROM mps_view2
WHERE donem IN ('200612','20071...
I have a table in SQL Server with these records :
ID Date Time
-- --------- ----
1 09/05/02 6:00
2 09/05/02 8:00
3 09/05/03 6:00
4 09/05/04 8:00
5 09/05/04 6:00
I would like to select those ID who have records in a day which are repeated twice or multiple of two.
How wo...
Hi,
I have 2 tables: ATTACHEMENTS and EMAILS (analogic example). ATTACHEMENTS table holds for each row ReferenceID to email it belongs to. Also I email can have 0 or more attachements.
Tables looks like:
Emails
UID Column1, Column2 ...up to 20 columns
1
2
3
4
Attachements
UID Ref...
Oracle PL/SQL won't let users to use aliases in conditions. In most cases it's very practical for me to use aliases instead of long statements. What's the reason for that? What bad would happen if we could use aliases in conditions?
Example case: http://stackoverflow.com/questions/2235166/whats-wrong-with-this-sql-query
...
I am displaying a property from the following table given below. Now what i have to do is, find the property in the same location(suppose my property is located in sec-19, match for sec-19 and if none of them found there then search for the entire city) with the following condition that it should be posted 10 days back or if none is post...
Hi,
I'm trying to get my head around whether it would be possible to do something with an FQL multi-query rather than multiple API calls.
Here is my code:
var queries : Object = {
"user_list":"SELECT uid2 FROM friend WHERE uid1 = "+uid
,"event_id":"SELECT eid, start_time, end_time, location, pic, name FROM event
WHERE eid IN (SELE...
CREATE TABLE DMS_POP_WKLY_REFRESH_20100201 NOLOGGING PARALLEL AS
SELECT wk.*,bbc.distance_km ,NVL(bbc.tactical_broadband_offer,0) tactical_broadband_offer ,
sel.tactical_select_executive_flag,
sel.agent_name,
res.DMS_RESIGN_CAMPAIGN_CODE,
pclub.tactical_select_flag
FROM spineowner.pop_wkly_refresh_20100201 w...
Assume we have a popular site. We need to implement mail-like messaging between users.
Typical solution is to use 2 tables:
Users (user_id)
Messages (message_id, sender_id (references user_id), receiver_id (references user_id), subject, body ).
This method has 2 significant limitations
All messages of all users are stored in one tab...
I'm using the following as part of an ActiveRecord find method:
:conditions => "created_at > date_sub(now(), INTERVAL 7 DAY)"
This works properly on my development server where I'm using MySQL, but I'm deploying to postgreSQL which doesn't have a date_sub function. Ignoring the fact that I'm using two different databases, does Rails h...
I have two columns in different product tables.
tblproduct1.partno is an old product list
tblproduct2.partno2 is a new one
Both partno columns should have identical model numbers but they don't.
When executing the below query, I get about 300 model numbers that don't match when comparing counts from both tables. tblproduct2 has 1955...
Is there any data type greater than CLOB in oracle
...
how do I swap records in SQL . I have a case in which I have to swap records of one employee to other , for example I have to update like " A's hat on B's head and B's hat on A's head" .
Only I need the query , i have the fields.
what should be the best approach for this? Is there any easy query for this ?
...
I've just restructured my database to use partitioning in Postgres 8.2. Now I have a problem with query performance:
SELECT *
FROM my_table
WHERE time_stamp >= '2010-02-10' and time_stamp < '2010-02-11'
ORDER BY id DESC
LIMIT 100;
There are 45 million rows in the table. Prior to partitioning, this would use a reverse index scan and s...