I have 3 tables (follows, postings, users)
follows has 2 fields -> profile_id , following_id
postings has 3 fields -> post_id, profile_id, content
users has 3 fields -> profile_id, first_name, last_name
I have a follows.profile_id value of 1 that I want to match against.
When I run the SQL statement below I get the 1st step in obtai...
How to write a query that can find me all item_number start with a certain value ?
For instance there are item_numbers like these :
123_abc
123_xyz
ierireire
321_add
999_pop
My current query looks like this :
"select from "+PayPal_Message.class.getName()+" where item_number == '"+Item_Number+"' order by item_number desc"
What's a q...
Hi
We are using "Enterprise Library Data Access Application Block" to access SQL Server database. In DataAccess layer, we are calling application block's API. Internally it must be resolving the command and parameters into SQL statement.
How can I know what SQL query goes to database?
Thanks
AJ
...
I have a table that has 5,000(table1) lines in it. Currently, 3,000 of them are filled up with data. The remaining values are currently null. In a separate table(table2), I have the remaining 2,000 rows of data. I am simply trying to take the values in table2 and put them in table1, but this statement isn't working:
Update table1
Set ...
Don't know if this is possible, I am looking a writing social network-esque code but need a bit of help.
SELECT wall.Wid, wall.uid, wall.wcomment, wall.name, comment.wid, comment.comment,comment.wid
FROM wall
LEFT JOIN comment ON wall.Wid=comment.wid
WHERE wall.uid in (SELECT fid from friends where uid = 3)
Cheers guys
...
I'm trying to build a rather specific query to find a set of user_ids based on topics they have registered to.
Unfortunately it's not possible to refactor the tables so I have to go with what I've got.
Single table with user_id and registration_id
I need to find all user_ids that have a registration_id of (4 OR 5) AND NOT 1
Each row is...
I have a table with 2 columns: integer and var char. I am given only the integer values but need to do work on the var char (string) values.
Given an integer, and a list of other integers (no overlap), I want to find the string for that single integer. Then I want to take that string and do the INSTR command with that string, and all th...
I am working to implement a data connection between my C# application and a SQL Server Express database. Please bear in mind I have not worked with SQL queries before.
I have the following relevant tables:
ArticlesCommon
ArticlesLocalized
CategoryCommon
CategoryLocalized
The ArticlesCommon table holds language independent information...
I have a table with two columns - the key contains the image name, like love_me.jpg. The second column contains the link for this image (IE: http:\...\love_me.jpg).
I want a query that will extract the link if I search using only "love".
...
I'm trying to write a quick (ha!) program to organise some of my financial information. What I ideally want is a query that will return all records with financial information in them from TableA. There should be one row for each month, but in instances where there were no transactions for a month there will be no record. I get results li...
Is there an ORM out there which easily supports SQL's query notifications, so that when one client updates some data, other clients are alerted to the fact that their data is now outdated?
Ideally I'd like an ORM which manages object identity itself - that is - it refreshes already loaded objects as opposed to always creating new ones.
...
i have below table
it_id item_id item_name
1 ite_1 shirt
2 ite_10 pant
3 ite_11 socks
4 ite_12 shoes
5 ite_13 belt
now i need to change item_id with with ite_(value of it_id of that row)
means if it_id=x then item_id should be ite_x and so ...
There are 4 tables:
Books : id, name, author, ecc...
Category : id, name
Library : id, name, street, city, ecc..
bookcorr : book_id, category_id, library_id
Ids are all keys.
The query must show the categories with the numbers of books in a defined Library. for ex:
Library X:
Romantic (50)
Yellow (40)
Scien...
This is part two of the question: http://stackoverflow.com/questions/2913639/mysql-make-this-query-faster-theres-a-way
this query still run slowly:
SELECT b.id,
b.name,
c.name
FROM bookcorr as a JOIN books as b on b.id = a.books_id =
JOIN Library as c on c.id = a.library_id
WHERE a.category_id = '2521'
AND a.library_id ...
Hello,
I have some JSON of which the following is a small sample:
results": {
"div": [
{
"class": "sylEntry",
"id": "sylOne",
"div": [
{
"class": "sT",
"id": "sOT",
"p": "Mon 11/17, Computer work time"
},
{
"class": "des",
"id": "dOne",
"p": "All classes Siebel 0218"
}
]
},
I would like to only retrieve ...
Let's say:
I want to query colA, colB and colC in my table.
I want to see DISTINCT values but I don't want colA to be a criteria for distinction.
Omitting colA isn't an option.
What's the best way to structure that query?
...
I have this Query:
SELECT p.ProductName,
dt.MaxTimeStamp,
p.Responsible
FROM Product p
LEFT JOIN (SELECT ProductID, MAX(TimeStamp) AS MaxTimeStamp
FROM StateLog
WHERE State = 0
GROUP BY ProductID, State) dt ON p.ProductID = dt.ProductID
ORDER BY p.ProductName;
It works ...
I have the table with zip codes with following columns:
id - PRIMARY KEY
code - NONCLUSTERED INDEX
city
When I execute query
SELECT TOP 10 * FROM ZIPCodes
I get the results sorted by id column. But when I change the query to:
SELECT TOP 10 id FROM ZIPCodes
I get the results sorted by code column. Again, when I change the query t...
Hai.
I am using Face book Connect FQL Queries to extract my profile photo url that is src_big,src_small URL.
But i am always getting the empty array in below delegate
(void)request:(FBRequest*)request didLoad:(id)result
My FQL query is.
NSString* fql = [NSString stringWithFormat:@"SELECT src_big,src_small FROM photo WHERE pid IN...
I have a SQL Query which works in SQL Management Studio:
Select Id
From table t
Where t.Date=
(Select Max(Date)
From (
Select *
From table where ReferenceId = xy) u)
Reason is, from all entries with a certain foreign key, I want to receive the one with
the highest date.
I tried to reform this Query for use in NHiber...