Author Topic: Question for the SQL folks  (Read 209 times)

Offline BlckMgk

  • Nickel Member
  • ***
  • Posts: 716
Question for the SQL folks
« on: January 27, 2005, 01:22:19 PM »
EDIT: Currently the File is in Excel... I was going to import it into Access. Unless I can do something like this in excel.
____________

I have a table with data organized like so:
Merchandise |  Size

What I would like to do is create a query which matches a certain Merchandise & Size to = MerchSize

i.e.
Merchandise | Size
POLO            | XL

changed to

MerchSize
POLOXL

But then I need to change them into a specific stock # i.e.
POLOXL will become P-1001BLXL

...

My SQL is rusty and don't have any manual's around.. and you guys are always on the ball.. (mini tech support)

Thanks in advanced
« Last Edit: January 27, 2005, 01:42:29 PM by BlckMgk »

Offline beet1e

  • Persona Non Grata
  • Platinum Member
  • ******
  • Posts: 7848
Question for the SQL folks
« Reply #1 on: January 27, 2005, 01:34:28 PM »
In DB2, it would be something like
SELECT MERCHANDISE [COLOR=BLUE]CONCAT[/COLOR] SIZE FROM T_MERCHTABLE ;
Note, in DB2 the keyword CONCAT joins two columns together. If you were building another table from this query, you might want to make the above query a subselect of an outer query.

Don't know how much data you have - if building a large table (2m+ rows) this way, I'd be concerned about the amount of data being written to the log, and how long the query would take.

Offline Furball

  • Plutonium Member
  • *******
  • Posts: 15780
Question for the SQL folks
« Reply #2 on: January 27, 2005, 01:41:33 PM »
I am not ashamed to confess that I am ignorant of what I do not know.
-Cicero

-- The Blue Knights --

Offline T0J0

  • Silver Member
  • ****
  • Posts: 1056
Question for the SQL folks
« Reply #3 on: January 27, 2005, 01:43:01 PM »
String || String =String concatenation

"Postgre" || "SQL" = postgreSQL

Might help?

TOJO

Offline JoOwEn

  • Parolee
  • Copper Member
  • **
  • Posts: 157
Question for the SQL folks
« Reply #4 on: January 27, 2005, 01:43:42 PM »
10 Just type in c++ its very cool.
20 next line
15 format c:
015 yo mama()

Offline BlckMgk

  • Nickel Member
  • ***
  • Posts: 716
Question for the SQL folks
« Reply #5 on: January 27, 2005, 01:45:16 PM »
Quote
Originally posted by JoOwEn
10 Just type in c++ its very cool.
20 next line
15 format c:
015 yo mama()

how about

kill c:\

?

Offline beet1e

  • Persona Non Grata
  • Platinum Member
  • ******
  • Posts: 7848
Question for the SQL folks
« Reply #6 on: January 27, 2005, 01:45:48 PM »
T0J0 - ah yes - that || thing - that means the same thing as CONCAT in DB2. I generally used CONCAT because where SQL was transmitted from PC to mainframe (and therefore from ASCII to EBCDIC) || could get converted into bizarre characters...

Offline T0J0

  • Silver Member
  • ****
  • Posts: 1056
Question for the SQL folks
« Reply #7 on: January 27, 2005, 01:52:41 PM »
Quote
Originally posted by beet1e
T0J0 - ah yes - that || thing - that means the same thing as CONCAT in DB2. I generally used CONCAT because where SQL was transmitted from PC to mainframe (and therefore from ASCII to EBCDIC) || could get converted into bizarre characters...


Funny I was just writing a custom formula for combing a field with another field for accounting cost codes and had print out some formulas for Crystal reports just minutes ago ...But Crystal doesn't quite look at concatenate the same as SQL versions or excel, they have to be fricken special...

TOJO