Hi, I'm wondering how I can sort mysql data based on the number of entries.
I'm doing this so I can have a page of the top purchases, so it would have to retrieve all the product_id's from a table, and then sort them by the most times one shows up, limiting it to 10 or something.
Thanks!
...
Hi all,
I have a sql query which is executing a LEFT JOIN on 2 tables in which some of the columns are ambiguous. I can prefix the joined tables but when I try to prefix one of the columns from the table in the FROM clause, it tells me Unknown column. I even tried giving that table an alias like so ...From points AS p and using "p" to...
Hey all
i have 3 tables each as follow
cash_credit
Bank_Name-------in_date-------Com_Id---Amount
America Bank 15/05/2010 1 200
HSBC 17/05/2010 3 500
Cheque_credit
Bank_Name-----Cheque_Number-----in_date-------Com_Id---Amount
America Bank 74835435-5435 15/05/2010 2 600
HSBC ...
Hi,
I've an SQL database and I would like to do a query who show all the datas containing the sign "%". Normally, to find a character (for example: "z") in a database I use a query like this :
mysql_query("SELECT * FROM mytable WHERE tag LIKE '%z%'");
But here, I want to found the % character, but in SQL it's a joker so when I write:...
Hi,
I have a database in MS SQL Server 2008, I have Stored Procedures. One of them does an INSERT with parameters. It works in Server Management Studio.
Now I'd like to make a button in Visual Basic 2008 that executes this SP. I have made a DataSet, it contains my 3 SP's, I can easily use 2 of them, because they return data, but the one...
Will the following code lead to a deadlock or should it work without any problem? I've got something similar and it's working but I didn't think it would. I thought the parent procedure's lock would have resulted in a deadlock for the child procedure but it doesn't seem to be.
If it works, why? My guess is that the nested FOR UPDAT...
I am looking at a practice test that doesn't have explanations about the correct answers. The question I'm confused about basically asks why the following SQL statement can never work:
SELECT oi.order_id, product_jd, order_date
FROM order_items oi JOIN orders o
USING(order_id);
The answer it gave was: "The statement would not execute ...
I understand that cubes are optimized data structures for aggregating and "slicing" large amounts of data. I just don't know how they are implemented.
I can imagine a lot of this technology is proprietary, but are there any resources that I could use to start implementing my own cube technology?
Set theory and lots of math are probabl...
I have a search that is taking 10 seconds+ to execute! Keep in mind it is also searching over 200,000 products in the database. I posted the explain and MySQL query here.
1 SIMPLE p ref PRIMARY,products_status,prod_prodid_status,product... products_status 1 const 9048 Using where; Using temporary; Using filesort
1 SIMPLE v...
I'm not much of a database guru so I need some help on a query I'm working on. In my photo community project I want to richly visualize tags by not only showing the tag name and counter (# of images inside them), I also want to show a thumb of the most popular image inside the tag (most karma).
The table setup is as follow:
Image tabl...
how can I determine the number of CoE students per school per city?
the coe students belongs to a different table from the school table from the city table. I really need some help now. thanks
...
How can I update a table (MyTable) from a aprticular database (DB1) by equating the said MyTable from a different database (DB2) but it has the same tablename with the one I need to update. I tried putting alias to my program but it doesn't work. Need Help
...
Are SQL Developers and SQL Programmers same people? I have basic knowledge about SQL and want to improve it. plz help me?
...
UPDATE polls_options SET `votes`=`votes`+1, `percent`=ROUND((`votes`+1) / (SELECT voters FROM polls WHERE poll_id=? LIMIT 1) * 100,1)
WHERE option_id=?
AND poll_id=?
Don't have table data yet, to test it properly. :)
And by the way, in what type % integers should be stored in database?
Thanks for the help!
...
I was wondering if there's a drawback (other than bad practice) to using something like this
SELECT * FROM my_table WHERE id LIKE '1';
where id is an integer. I know you're supposed to use id=1 but I am writing a java program and if everything can use LIKE it'll be a lot easier for me. Also, so far, everything works fine; I get the co...
I have a this table, where I store multiple ids and an age range (def1,def2)
CREATE TABLE "template_requirements" (
"_id" INTEGER NOT NULL,
"templateid" INTEGER,
"def1" VARCHAR(255),
"def2" VARCHAR(255),
PRIMARY KEY("_id")
)
Having values such as:
templateid | def1 | def2
-------------------------------
100 | 7 | ...
My practice shows that a general enterprise application has a lot of entities which's nature corresponds to an elementary enumeration. For example We may have an Order entity which may have such fields as "OrderType", "OrderStatus", "Currency", etc. referencing corresponding Entities which are nothing more than just a textual name bound ...
Hi,
I am passing a XML document as a input to a stored procedure in Microsoft SQL Server 2005.
This is the sample XML being passed as input
<Strategy StrategyID="0" TOStrategyID="8" ShutdownQtySell="1" ShutdownQtyBuy="1">
<ParameterRange ParameterSetID="6" ParameterRangeID="1" ParameterRangeFrom="0" ParameterRangeTo="20" Paramete...
Hi all
I would like to perform an sql search and I would like to get best results. I tried some things but they didn't work well. I have got two columns named subject and content
For example we will search "search this keywords" text on subject and content area. First I'm searching "search this keywords" then searching "search" and "th...
I have a table to entities (lets call them people) and properties (one person can have an arbitrary number of properties). Ex:
People
Name Age
--------
Jane 27
Joe 36
Jim 16
Properties
Name Property
-----------------
Jane Smart
Jane Funny
Jane Good-looking
Joe Smart
Joe Workaholic
Jim Funny
Jim Young
I wo...