Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    MYSQL


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Equivalent Function


I use the following function in Oracle
SELEC T decode(status,'A','Active','L','Active','Former') FROM Table

What it means is: if status = A, return "Active", if status=L, return
"Active", else return "Former" in the select statement.

Decode in mysql has nothing to do with this functionality and I didnt see a
function while browsing the docs online that did this. Is there an
equivalent function in mySQL?




View Complete Forum Thread with Replies

Related Forum Messages:
The Equivalent Of ISNULL Function
what is the equivalent function of ISNULL function in MYSQL.

View Replies !
An Equivalent For @@ERROR Function In MSSQL
Has MySql someting like @@error in MSSQL? if no, how i can find dynamically that error occured and it's number?

View Replies !
Equivalent Function To @@NESTLEVEL/TRIGGER_NESTLEVEL()
what is the equivalent in mySQL to @@NESTLEVEL, TRIGGER_NESTLEVEL() SQLSERVER functions ( triggers when recursive is over) ?

If there is not, how can I detect the recursive was over in another ways ?

View Replies !
Is There Any MySql Function Which Is Equalent To Oracle Last_Value Function
I am converting Oracle view to MySql where I am having the follwoing syntax in Oracle
last_value(col1 ignore nulls) over (partition by col2 order by col2, col3 rows between unbounded preceding and 1 preceding)

which I need to convert to MySql.

View Replies !
IF Function,GROUP BY,aggregate Function Problems
Yep, I have all those problems in the title. So I'll explain each one at a time - I did have another thread relating to this very same query but I thought it was time to update where I am with the query because at the moment I feel like I am getting nowhere!

The query I have basically searches through an items_ordered table through each product and checks to see whether the item is VATable or not. This is not where I have the problem though. Where I am really having the first problem is when I am trying to use the IF function to check if the TOTAL of an order is over £300. IF it is then I multiply it my 0.95 (i.e. 5% off). With the query below I get no errors but neither do I get the desired result. It's as though it couldn't even see it. =....

View Replies !
MySQL Equivalent To *nix 'more'
How do I prevent the MySQL client to scroll pages when the results of a query exceeds the number of lines in the terminal window? Like a MySQL equivalent to *nix 'more'.

mysql> select foo from bar;
[...]

2500 rows in set (0.00 sec)

View Replies !
Equivalent Boolean
I'm working with VB.NET and I'm pulling data from MySQL. .NET is looking
for a boolean value...and I'm wondering what type I should make the field in
my database.

View Replies !
MS Access Equivalent
I am new to Linux and am migrating a SQL Server DB with an Access front end
to MySQL and ?
What options are available under Linux for development of a client front end
without copious amounts of programming.
Without knowledge of PHP can a front end be developed using plugin
components with minimal fuss ?

View Replies !
Equivalent Expressions
Given a primary key field `RecNo` -

Are there any performance reasons to favor one of these two otherwise
equivalant expressions?

SELECT MAX(RecNo)
FROM SomeTable;

SELECT RecNo
FROM SomeTable
ORDER BY RecNo DESC
LIMIT 1;

View Replies !
Equivalent GROUPT_CONCAT
Is there a way to return the same results as when using GROUP_CONCAT in mysql versions earlier than 4.1?

View Replies !
Equivalent In MySQL
I have a MS SQL server, there I have a DTS (data transformation services) package designed, the MS SQL connects to a DB2 Database on an IBM AS400 server, gets some data from specified tables and replicates them locally on the MS SQL Database.I need to do the same using MySQL, I'dont know if Cron will do the job or does the latest version of MySQL has this feature, and how do I use it.

How do I connect to a DB2 database from MySQL to grab some data, and how do I schedule this task to run every certain time?I have the latest stable version of MySQL as of August 2006 installed on Ubuntu 6.06 Server

View Replies !
Dmax Equivalent
Up to now I've been using Access databases with ASP which has been working fine. I'm now converting the Access database to a MySQL one. One problem I'm having is with the DMax function in Access.

I'm trying to find a way of acheiving the same thing as DMax in a MySQL query.

I know I can use the MAX function, but I need to find the max record in another table and specify criteria for it which MAX doesn't allow.

Script in Access:
SELECT id, DMax("col2","table2","recordid=" & id) AS maxid FROM table;

View Replies !
Join Equivalent?
SELECT a.`vid` FROM `openid_ax_values` a ,`openid_ax_values` b WHERE a.`ax_id`=b.`ax_id` AND (a.`persona_id`=2 AND b.`persona_id`=3)

View Replies !
Equivalent To Xp_fileexist And Others
Are there MySQL equivalents to the MSSQL xp_fileexist and other command shell functions?

I'm looking for a way to loop thru a set of files in a directory, move them, and create directories. On a Windows box.

View Replies !
Equivalent To ISDATE
I want to check if a value is date or not. In Access i was using the function ISDATE, there are any way to make this in MySQL?

View Replies !
Equivalent Of @@IDENTITY
In Microsoft SQL, there is a special variable called @@IDENTITY that always contains the primary key of the last entry that was inserted into a table.

Is there an equivalent of this in MySql?

View Replies !
@@rowcount, @@error Equivalent
is there a '@@rowcount', '@@error' equivalent in mysql to use inside a
stored procedure after a query statement?

View Replies !
Rollback Segment Equivalent
What is the equivalent of rollback segments (from Oracle) on MySQL? And if something is being used internally, can I change the size of this? I do not want to run into problems like exceeded rollback size or something like that.

View Replies !
CAST() To Float Or Equivalent?
Is there a way to use CAST() to convert a string MySQL field to a 'float'
value? I know I can convert a string to a SIGNED or UNSIGNED integer value,
but not float. I tried FLOAT, DECIMAL, and a few others and they were all
rejected. Right now I am using the following bit of silliness to get around
it:

CAST(strField * 100 AS SIGNED)/100

But I am hoping there is something more direct.

View Replies !
STR_TO_DATE Equivalent In MySQL 4.0.23
is there an equivalent to the STR_TO_DATE function of MySQL 4.1 in MySQL 4.0? Or can I use the DATE_FORMAT function also for INSERTs?

I want to do something like the following, where the coloumn tag_id is of the DATE type:

INSERT INTO LU_Tag (tag_id, monat_id, woche_id, sonderaktion_id) VALUES (DATE_FORMAT(' 1. 1.1999','DD.MM.YYYY'), 1,NULL,NULL);

View Replies !
4.0.x Equivalent/alternative For Group_Concat?
The following query works great on my test machine with mySQL 4.1.x. However, because cPanel is taking their sweet time working in mySQL 4.1, I can't use this on my website. Is there 'any' way to accomplish this same type of return in mySQL 4.0.22? Code:

View Replies !
Model Database Equivalent
SQL Server has the Model Database concept. Is there someting equivalent for MySQL.

View Replies !
Intersect Equivalent For Mysql?
i have a table that relates information from two other tables via the use of foriegn keys.

here is a sample:
fk1 -- fk2
1 -- 1
1 -- 2
1 -- 3
2 -- 2
2 -- 4
3 -- 3
3 -- 6
3 -- 7
4 -- 1

I need a query that will return the following result set:
fk_table1Id where fk_table2Id=1 and fk_table2Id=2 and fk_table2Id=3
(obviously this cannot be done this way b/c fk_table2Id cannot equal more than one condition).

For this condition, I want to return 1, but not 2, or 3, or 4. With other databases I could just perform several different queries and intersect them, but mysql doesn't support an intersect. Anyone know of a good way to do this? BTW, this table has over 2 million rows, and time is a factor.

View Replies !
Equivalent For Oracle Lead()
How can i select the next record?I want "nexthiredate" for the current record to be the hiredate of the next record belonging to employee of same department (deptno).Data is sorted on deptno, hiredate.

Oracle code is: .....

View Replies !
Combining Two Equivalent Tables Together
how I can combine two equivalent tables together to one table? Example:

User Table with attributes: ID and password

Admin Table with attribues: ID and password

If I am using a nartural join ( select User.Id, Admin.Id from User, Admin; ) to get only the Ids from both tables, MySQL will create a new table with two Attributes: Id and Id, but I want to combine the content from Id so that I will have a table only with one attributes ( ID ) with all the content from both tables?!

View Replies !
Equivalent Of PHP Substr_count() In MySQL
Is there an equivalent function in MySQL that performs the same as PHP's substr_count() function?

View Replies !
!empty() Speedy Equivalent
Very simple one, I'm in the optimization phase and have a bite-sized question if anyone can help--

// Trying to select all news where there is an image
// The field 'image' stores the image's filename
SELECT * FROM news WHERE image != ''

My assumption is that this query is slow, naturally, compared to adding a new field called has_image with a value of 0 or 1 and running:
SELECT * FROM news WHERE has_image = 1

Is this a sound assumption that the latter would be faster than the former? It does seem a little redundant though to add a new field. Is there a 'best' way to accomplish this task?

View Replies !
Equivalent Of Transaction Count Of SQL Server
Is there an equivalent in mysql for Transaction count variable of Sql server?

View Replies !
Is There A Start With/connect By Equivalent In MySQL?
Code:

select * from user where referer='colpaarm'

Simple enough, but I not only want to get the people a user directly referred, but I want to get the people the referees referred, etc. etc. So if I referred ten people and those ten people referred 40 people and those 40 people referred 120 people, I want to get that whole structure and give credit to the original referrer.

In oracle, this is trivial when using the start with/connect by clause. It would be

Code:

select * from user
start with user='colpaarm'
connect by prior user=referer

View Replies !
Mysql.sock Equivalent On Windows
which exe program in the bin of 5.1 on windows is equivelent to the mysql.sock on unix type systems?

View Replies !
What Is Equivalent Of Lag And Lead Functions In Oracle
Whats MySQL's function which performs the same (or at the very least similar) function as Oracle SQL's LAG and LEAD functions?

View Replies !
Query Analyzer Equivalent For MySQL
MSSQL has the Query Analyzer....what is the equivalent on MYSQL's side.

View Replies !
Equivalent Of 'UNION' In MySQL Syntax?
How can I express this in MySQL syntax?

(SELECT Value, Name
FROM orderTable
WHERE id = '1jn8')
UNION
(SELECT Value, Name
FROM orderTable
WHERE ct_id = '12dNOI')
UNION
(SELECT Value, Name
FROM orderTable
WHERE country = 'US').

View Replies !
Mysql Equivalent Of Guid Datatype
helo, I'm using on PDA guid as primary key datatype. I wonder why it isn''t available in MySQL.

Now I have to define my tables on the server. As guid is not available, what should I take?

View Replies !
Stored Procedure Mssql EXEC Equivalent
Is there an equivalent to the mssql exec command that can be used in
stored procedures?

View Replies !
5.0 Stored Procedure Mssql EXEC Equivalent
Is there an equivalent to the mssql exec command that can be used in
stored procedures?

View Replies !
Mysql Equivalent To MS Access Parameter Query
i got a table called countries with columns called country, yr1998, yr1999

what i want to do is be able to run a query that will ask me to enter a country name?

View Replies !
Update Equivalent Of Create Table If Not Exists
"Update if exists" does not work. What does? I need the update run to run only if a certain table actually exists.

View Replies !
MySQL Equivalent For Oracle DECODE Statement?
Is there a MySQL equivalent for Oracle's DECODE statement ? I am looking for code that will allow me to transform columns/rows within the SQL query.

My query returns data like this:

Date | Indicator | Name
---------------|----------------|---------------------------
01/01/2004| 1 | Mr Smith
01/01/2004| 2 | Mr Brown
02/01/2004| 1 | Mr Jones
02/01/2004| 2 | Mr White
02/01/2004| 3 | Mr Black

I would like to transform this to return as:

Date | 1 | 2 | 3
--------------- |--------------|--------------|--------------
01/01/2004 | Mr Smith | Mr Brown |
02/01/2004 | Mr Jones | Mr White | Mr Black

i.e. the values in the indicator column become the column headers.

View Replies !
Equivalent To MS SQL "Linked Server"
Is there an equivalent to "Linked Servers" on the SQL Server platform?

If so, I'll continue my exploration into MySQL... I've installed servers on Linux and Windows and have yet to come up with a GREAT GUI management tool but I'm sure it's out there (any suggestions?) Anyway, my question is...

"Is there an equivalent to "Linked Servers" in MySQL?"

I need to access other DB's as though they were local and have a central spot for development.

View Replies !
Equivalent Of "sysdate"
I need to set a date column with the current system date. In Oracle, I'll use "sysdate"; can anyone pls advise the equivalent in MySQL?

View Replies !
Max Function
I have a table with name, priority and parent as three columns...I want to get the max(priority) grouped by the parent... I am trying to get name, priority, parent, max(parent) as the four columns in the result...Could some one help me with this

select name, priority, parent from table1
select max(priority) from table1 group by parent

are the two select statements that I wish to combine...is it possible..?

View Replies !
SQL IN() Function
so i have a query such as
SELECT first_name FROM users WHERE user_ID IN (5,4,8,19,8,4) and i want the first_name to be retrieved for EACH of the cases (eg. name is repeated twice for 4 and 8)

View Replies !
Last Function
How do you get the last row in a grouped query. I have a table with running balances. At the end of the day, I want to find out the last balance.

select *
from accounts
group by date(dateCol)

This always gives me the first row of the grouped column dateCol.

View Replies !
Avg Function
Why doesn't this work:

SELECT avg(value) as avg_value from playerstats where avg_value = '100' and stattype = 'r' group by avg_value

I'm trying to select the avg_value of 'r' where the avg_value = '100'.

View Replies !
Looking For A Particular Function
I have a Column which consists of only DATE's and an ID code. I want to enumerate all the DATE's of a certain ID to get a grand total of a ID. Does such a function exist?

View Replies !
Using The AVG Function
I am trying to use this query:

SELECT average(price) FROM `data` WHERE id IN ( '3', '3', '6' )

to average the price of items users select. The problem is that when a user selects a value more than once it only includes it in the average once. How can I make it average all the values?

View Replies !
Now() Function
I am using now function to get current date when info is added to my table. I am using a hosting provider that is 6 hrs ahead in time zone so i always have to subtract 6hrs to get the correct time. Is there anyway I can format the time to be inserted to my time zone?

View Replies !
SOUNDEX Function
I'm using SOUNDEX mysql function to find similar sounding names from
a table with 2 million distinct names.

Unfortunately there is a single soundex code for every 200,000 names!
Meaning there are only 200,000 distinct codes for 2 million entries.

Is there any other function / library / technique to work around this
immense 1:10 redundancy ?

for example, soundex for 'avis', 'apex' and 'apps' is A120, but I'd
like to differentiate between them in my search - meaning implement a
"stricter" sound comparison than the soundex function offers.

View Replies !
Group_concat Function
I am attempting to pull data from multiple tables into a resultset that
I can use as an Excel spreadsheet for reporting. Code:

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved