does anybody know how to do this syntax below in mysql?
without Stored Procedure
and in single query only
SELECT CASE
WHEN COUNT(v.value) = 0 THEN (
INSERT INTO tbl_v (fid, uid, VALUE)
SELECT fid, 1 AS uid, 'xxxxxx' AS VALUE FROM tbl_f
WHERE category = 'categoryname' AND NAME = 'somevalue'
)WHEN v.value <> 'test' THEN (
'u...
Hi,
I have a .net datatable...from which I am filtering rows using datatable' select function
Assume the datatable as below
Id | Name | Description |
1 | Anish| "sachin's centuary" |
If I search my datatable as...
datatable.select("Description = 'sachin's centuary'")...it is not returning any rows because
of the "sin...
When an option is selected the corresponding checkbox <div> is automatically hidden using jQuery. For example, user selects Item 1 from the select box, and <div class="item1"> is immediately hidden.
Caveat: Both will be visible, so the user changing the select option must be accounted for (eg. user selects an option who's corresponding...
If I have an array of say, some ID's of users. How could i do something like this:
$array = array(1,40,20,55,29,48);
$sql = "SELECT * FROM `myTable` WHERE `myField`='$array'";
Is there a simple way to do this, I thought about looping through array items and then building up one big "WHERE -- OR -- OR -- OR" statement but i thought tha...
Query #1:
SELECT DISTINCT `title`
FROM `table`
WHERE (
`title` LIKE '%this is search%'
)
OR (
`title` LIKE '%this%'
AND `title` LIKE '%is%'
AND `title` LIKE '%search%'
)
OR (
`title` LIKE '%this%'
OR `title` LIKE '%is%'
OR `title` LIKE '%search%'
)
LIMIT 0 , 10
but not works good , and when I try splited this sql:
Query #2:
SELE...
Apparently, include and select can't be used simultaneously on a Rails find query, and this has been repeatedly marked as wontfix:
http://dev.rubyonrails.org/ticket/7147
http://dev.rubyonrails.org/ticket/5371
This strikes me as very inconvenient, because the times I'd want to use include are exactly the same times I'd want to use select...
In order to do object picking in OpenGL, do I really have to render the scene twice?
I realize rendering the scene is supposed to be cheap, going at 30fps.
But if every selection object requires an additional gall to RenderScene()
then if I click at 30 times a second, then the GPU has to render twice as many times?
...
i have a table with about 200,000 records.
it takes a long time to do a simple select query. i am confiused because i am running under a 4 core cpu and 4GB of ram.
how should i write my query?
or is there anything to do with INDEXING?
important note: my table is static (it's data wont change).
what's your solutions?
PS
1 - my table h...
I have 2 tables:
1. products
- product_id
- title
2. product_categories
- product_id
- category_id
Each product can have more than one category. I store this information in the product_categories table. I want to be able to SELECT all the category_ids when I select a product in 1 query. How can I do this? I have the following so far, ...
id - a_id - a_type
---------------------------
1 9 Granny Smith
2 9 Pink Lady
---------------------------
3 3 Pink Lady
4 3 Fuji
5 3 Granny Smith
---------------------------
6 7 Pink Lady
7 7 Fuji
8 7 Fuji
9 7 Granny Smith
Ok, assum...
I have a LaTeX document which is basically one big enumerate environment, with a few hundreds of items. I want to be able to issue a command like
\printitems{2,5,12,45-48}
which will output only the requested items.
A similar command \onlyslides is a part of slides.cls, but I cannot figure out what goes on there and adapt it to my ne...
Hi, I have a table where I should count if an user has reached a number of penalities like 3, so if the user reach or surpass 3 points, he's banned:
table_warnings
- id
- user_id
- warning
- warning_date
id user_id warning warning_date
1 5478 1 2010-02-25 12:59:00
2 5478 1 2010-02-28 08...
Hi All,
I'm developing a web application myself to follow some rssfeeds. My purpose is just learning
some ajax and i send data from server to client side in JSON format. I use LINQ for querying data and JSON .NET API for object to string Serialization in the server side. The problem is that because of there exists foreign keys between ...
hi
is it possible to execute a SELECT command on a mysql host db2, being logined to mysql host db1?
e.g. i'm logined on mysql server db1, and i want to SELECT some data from db1 tables and db2 server tables with one query. i've found out that i can use FEDERATED tables, but i'm looking for a simpler way, if it exists
...
Why is that, with default settings on Sql Server (so transaction isolation level = read committed), that this test:
CREATE TABLE test2 (
ID bigint,
name varchar(20)
)
then run this in one SSMS tab:
begin transaction SH
insert into test2(ID,name) values(1,'11')
waitfor delay '00:00:30'
commit transaction SH
and this one simultaneou...
How do I get my mysql database to return 0 if the neighborhood in the WHERE clause doesn't exist? So in the example below, Old Town is not in the database. I'd like the database to return 0 incidents instead of an empty result.
SELECT incidents,
neighborhoods
FROM `myTable`
WHERE neighborhoods ='Old Town'
I also tried
SEL...
I have a structure like the following:
<form>
<input type="text" />
<input type="text" />
...
<input type="radio" />
<input type="whatever" />
Here I have some text
</form>
I cannot change the structure of the HTML. I need to remove via Javascript the text inside the form, and the problem is to select it, since...
I'm trying to grab some data from my SQL database as below;
USE exampleDatabase
SELECT TOP(1) [Name] FROM [Peeps] ORDER BY [Weight] DESC
SELECT TOP(1) [Name] FROM [Peeps] ORDER BY [Age] DESC
The problem is when I read the data I get an error 'Name'.
Dim byWeight As String = sqlReader.GetValue(sqlReader.GetOrdinal("Name"))
Dim byAge A...
Hi!
I'm developing an Eclipse plug-in where upon pressing a button, the plug-in takes the selected text in the java editor and puts in a text box which appears.
My code looks like this: I got it from here: http://dev.eclipse.org/newslists/news.eclipse.newcomer/msg02200.html
private ITextSelection getSelection(ITextEditor editor) {
...
SELECT * FROM ...LIMIT 5, 10
But what if I want the total rows? I don't want to make another query without the limit. I just want this one query to return the total rows if I didn't put the LIMIT in there.
...