Ver Mensaje Individual
  #10 (permalink)  
Antiguo 07/04/2014, 08:17
Avatar de gnzsoloyo
gnzsoloyo
Moderador criollo
 
Fecha de Ingreso: noviembre-2007
Ubicación: Actualmente en Buenos Aires (el enemigo ancestral)
Mensajes: 23.324
Antigüedad: 16 años, 5 meses
Puntos: 2658
Respuesta: Saber las cantidades vendidas de un producto

Cita:
Separators in Non-U.S. Dates

Nothing causes more confusion for international users than Firebird's restricting the use of the forward slash character (/) to only the U.S. 'MM/DD/CCYY' format. Although almost all other countries use 'DD/MM/CCYY', Firebird will either record the wrong date or throw an exception with the date literal using the 'DD/MM/CCYY' convention.

For example, the date literal '12/01/2004' will always be stored with meaning "December 1, 2004" and '14/01/2004' will cause an out-of-range exception because there is no month 14.

Note that Firebird does not honor the Windows or Linux date locale format when interpreting date literals. Its interpretation of all-number date formats is decided by the separator character. When dot (.) is used as separator, Firebird interprets it as the non-U.S. notation DD.MM, whereas with any other separator it assumes the U.S. MM/DD notation. Outside the U.S. date locale, your applications should enforce or convert locale-specific DD/MM/CCYY date input to a literal that replaces the forward slash with a period (dot) as the separator. 'DD.MM.CCYY' is valid. Other date literal formats may be substituted.
Código SQL:
Ver original
  1. SELECT VD.producto_nombre
  2. FROM ventas VE
  3.     INNER JOIN ventas_detalles VD ON VE.correlativo = VD.correlativo_principal
  4.     INNER JOIN productos_compuestos PC ON VD.producto_codigo = PC.codigo_producto
  5.     INNER JOIN productos_compuestos_partes PCP ON PC.codigo_producto = PCP.parte_producto_codigo
  6.     INNER JOIN productos_terminados PT ON PCP.parte_producto_codigo = PT.codigo_producto
  7. WHERE
  8.     (PT.nombre LIKE '%ADR%')
  9.     AND (VE.fecha_emision BETWEEN '17.03.2014' AND '24.03.2014')
  10.     AND (VE.temporal = 'F')

Cita:
Bueno generalmente cuando busco saber algo sobre BD lo posteo en SQL puesto que la sintaxis no suele ser "tan diferente" entre ellas
Son terriblemente diferentes entre si cuando se trata de fechas, horas y algunas funciones propias de cada DBMS.
NUNCA debes asumir que SQL Server (de Microsoft) es un estándar para BBDD y menos para SQL.
SQL no es SQL Server. Este último es uno de los DBMS que existen, pero no es ni el mejor, ni el más difundido.
__________________
¿A quién le enseñan sus aciertos?, si yo aprendo de mis errores constantemente...
"El problema es la interfase silla-teclado." (Gillermo Luque)